Michael Blow has submitted this change and it was merged.

Change subject: [NO ISSUE] Enable RPC to reconnect IPC handles
......................................................................


[NO ISSUE] Enable RPC to reconnect IPC handles

Change-Id: Ieea8ebedc58dbfd65dbc1cb13721eeb83b6a475a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2289
Sonar-Qube: Jenkins <[email protected]>
Reviewed-by: Murtadha Hubail <[email protected]>
Tested-by: Jenkins <[email protected]>
---
M 
hyracks-fullstack/hyracks/hyracks-examples/hyracks-shutdown-test/src/test/java/org/apache/hyracks/examples/shutdown/test/ClusterShutdownIT.java
M 
hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/api/RPCInterface.java
2 files changed, 13 insertions(+), 17 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found
  Murtadha Hubail: Looks good to me, approved



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,15 +20,14 @@
 
 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();
@@ -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);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2289
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieea8ebedc58dbfd65dbc1cb13721eeb83b6a475a
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>

Reply via email to