Merge branch 'gerrit/mad-hatter'
Change-Id: I1eb33cc6bd510528659f56a33296ed3252b7bbba
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
index eaae8e7..5834f26 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
@@ -477,8 +477,7 @@
final Object attachment = key.attachment();
if (attachment != null) {
final IPCHandle handle = (IPCHandle) attachment;
- handle.close();
- unregisterHandle(handle);
+ closeHandle(handle);
}
key.cancel();
}
@@ -527,6 +526,7 @@
connectionEstablished(handle, channelKey, socketChannel);
}
} else {
+ closeHandle(handle);
close(channelKey, socketChannel.getSocketChannel());
}
}
@@ -538,5 +538,12 @@
handle.setKey(channelKey);
channelKey.attach(handle);
}
+
+ private void closeHandle(IPCHandle handle) {
+ if (handle != null) {
+ handle.close();
+ unregisterHandle(handle);
+ }
+ }
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java
index 74deefe..f9bf5c7 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java
@@ -233,8 +233,11 @@
private void handleEndOfStreamQuietly() {
try {
- engine.closeInbound();
- close();
+ try {
+ engine.closeInbound();
+ } finally {
+ close();
+ }
} catch (Exception e) {
LOGGER.warn("failed to close socket gracefully", e);
}