[NO ISSUE] Enable RPC to reconnect IPC handles
Change-Id: Ieea8ebedc58dbfd65dbc1cb13721eeb83b6a475a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2289
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-shutdown-test/src/test/java/org/apache/hyracks/examples/shutdown/test/ClusterShutdownIT.java b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-shutdown-test/src/test/java/org/apache/hyracks/examples/shutdown/test/ClusterShutdownIT.java
index 6f4d8b1..49b2779 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-shutdown-test/src/test/java/org/apache/hyracks/examples/shutdown/test/ClusterShutdownIT.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-shutdown-test/src/test/java/org/apache/hyracks/examples/shutdown/test/ClusterShutdownIT.java
@@ -20,16 +20,15 @@
import java.net.ServerSocket;
+import org.apache.hyracks.api.client.HyracksConnection;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.ipc.exceptions.IPCException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.apache.hyracks.api.client.HyracksConnection;
-import org.apache.hyracks.api.client.IHyracksClientConnection;
-import org.apache.hyracks.ipc.exceptions.IPCException;
-
public class ClusterShutdownIT {
private static Logger LOGGER = LogManager.getLogger();
@Rule
@@ -40,21 +39,23 @@
hcc.stopCluster(false);
//what happens here...
closeTwice.expect(IPCException.class);
- closeTwice.expectMessage("Cannot send on a closed handle");
+ closeTwice.expectMessage("Connection failed to localhost/127.0.0.1:1098");
hcc.stopCluster(false);
ServerSocket c = null;
ServerSocket s = null;
try {
- c = new ServerSocket(1098);
- //we should be able to bind to this
- s = new ServerSocket(1099);
- //and we should be able to bind to this too
+ c = new ServerSocket(1098); // we should be able to bind to this
+ s = new ServerSocket(1099); // and we should be able to bind to this too
} catch (Exception e) {
- LOGGER.error(e.getMessage());
+ LOGGER.error("Unexpected error", e);
throw e;
} finally {
- s.close();
- c.close();
+ if (s != null) {
+ s.close();
+ }
+ if (c != null) {
+ c.close();
+ }
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/api/RPCInterface.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/api/RPCInterface.java
index ba1c9a4..7dae541 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/api/RPCInterface.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/api/RPCInterface.java
@@ -21,8 +21,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.hyracks.ipc.exceptions.IPCException;
-
public class RPCInterface implements IIPCI {
private final Map<Long, Request> reqMap;
@@ -34,9 +32,6 @@
Request req;
long mid;
synchronized (this) {
- if (!handle.isConnected()) {
- throw new IPCException("Cannot send on a closed handle");
- }
req = new Request(handle, this);
mid = handle.send(-1, request, null);
reqMap.put(mid, req);