GEODE-1076: CI Failure: Suspect string in DirectChannel.disconnect() Added error handling to DirectChannel.disconnect(). It doesn't know the state of the semaphores it is trying to release so it needs to handle the Error that might be thrown.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/6ce7e838 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/6ce7e838 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/6ce7e838 Branch: refs/heads/feature/GEODE-949-2 Commit: 6ce7e8384f02fa8dac2606cf5f5e5271ef87e9f4 Parents: b313470 Author: Bruce Schuchardt <[email protected]> Authored: Thu Mar 10 10:17:19 2016 -0800 Committer: Bruce Schuchardt <[email protected]> Committed: Thu Mar 10 10:18:29 2016 -0800 ---------------------------------------------------------------------- .../internal/direct/DirectChannel.java | 31 ++++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6ce7e838/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java index 06b40b8..9fe5260 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java @@ -70,8 +70,6 @@ import com.gemstone.gemfire.internal.util.Breadcrumbs; import com.gemstone.gemfire.internal.util.concurrent.ReentrantSemaphore; /** - * @author Bruce Schuchardt - * @author Darrel Schneider * DirectChannel is used to interact directly with other Direct servers to * distribute GemFire messages to other nodes. It is held by a * com.gemstone.gemfire.internal.cache.distribution.DistributionChannel, @@ -191,13 +189,8 @@ public class DirectChannel { * The maximum number of concurrent senders sending a message to a group of recipients. */ static private final int MAX_GROUP_SENDERS = Integer.getInteger("p2p.maxGroupSenders", DEFAULT_CONCURRENCY_LEVEL).intValue(); - private Semaphore groupUnorderedSenderSem; // TODO this should be final? - private Semaphore groupOrderedSenderSem; // TODO this should be final? - -// /** -// * cause of abnormal shutdown, if any -// */ -// private volatile Exception shutdownCause; + private Semaphore groupUnorderedSenderSem; + private Semaphore groupOrderedSenderSem; private Semaphore getGroupSem(boolean ordered) { if (ordered) { @@ -248,14 +241,6 @@ public class DirectChannel { } return false; -// Boolean b = getThreadOwnsResourcesRegistration(); -// if (b == null) { -// // thread does not have a preference so return default -// return !this.owner.shareSockets; -// return false; -// } else { -// return b.booleanValue(); -// } } /** @@ -809,8 +794,16 @@ public class DirectChannel { // this.shutdownCause = cause; this.disconnected = true; this.disconnectCompleted = false; - releaseGroupSendPermission(true); - releaseGroupSendPermission(false); + try { + groupOrderedSenderSem.release(); + } catch (Error e) { + // GEODE-1076 - already released + } + try { + groupUnorderedSenderSem.release(); + } catch (Error e) { + // GEODE-1076 - already released + } this.conduit.stop(cause); this.disconnectCompleted = true; }
