geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [17/35] incubator-geode git commit: GEODE-411: fix suspect string on disconnect
Date Tue, 03 Nov 2015 19:38:49 GMT
GEODE-411: fix suspect string on disconnect

DistributionManager now has a isCloseInProgress method
that checks both the volatile closeInProgress boolean
and ask its DistributedSystem if it is disconnecting.
This new method is used in places that decide if a warning
should be logged.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5f603b64
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5f603b64
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5f603b64

Branch: refs/heads/develop
Commit: 5f603b64f7ba759ca025eb5890f5d2c83d4f3d09
Parents: 6116054
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Tue Oct 27 16:26:59 2015 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Wed Oct 28 09:54:28 2015 -0700

----------------------------------------------------------------------
 .../internal/DistributionManager.java           | 42 +++++++++++++-------
 1 file changed, 28 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5f603b64/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
index 37f355f..f32f408 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
@@ -718,7 +718,7 @@ public class DistributionManager
       // error condition, so you also need to check to see if the JVM
       // is still usable:
       SystemFailure.checkFailure();
-      if (closeInProgress) {
+      if (isCloseInProgress()) {
         logger.debug("Caught unusual exception during shutdown: {}", t.getMessage(), t);
       }
       else {
@@ -2486,7 +2486,7 @@ public class DistributionManager
       try {
         listener.memberJoined(id);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2503,7 +2503,7 @@ public class DistributionManager
       try  {
         listener.memberJoined(id);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2515,6 +2515,20 @@ public class DistributionManager
       }
     }
   }
+  /**
+   * Returns true if this DM or the DistributedSystem owned by
+   * it is closing or is closed.
+   */
+  private boolean isCloseInProgress() {
+    if (closeInProgress) {
+      return true;
+    }
+    InternalDistributedSystem ds = getSystem();
+    if (ds != null && ds.isDisconnecting()) {
+      return true;
+    }
+    return false;
+  }
   private void handleCrashEvent(MemberCrashedEvent ev) {
     InternalDistributedMember id = ev.getId();
     for (Iterator iter = membershipListeners.keySet().iterator();
@@ -2523,7 +2537,7 @@ public class DistributionManager
       try {
         listener.memberDeparted(id, true/*crashed*/);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2540,7 +2554,7 @@ public class DistributionManager
       try {
         listener.memberDeparted(id, true/*crashed*/);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2562,7 +2576,7 @@ public class DistributionManager
       try {
         listener.memberDeparted(id, false);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2579,7 +2593,7 @@ public class DistributionManager
       try {
         listener.memberDeparted(id, false);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2600,7 +2614,7 @@ public class DistributionManager
       try {
         listener.memberSuspect(id, whoSuspected);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2617,7 +2631,7 @@ public class DistributionManager
       try {
         listener.memberSuspect(id, whoSuspected);
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2644,7 +2658,7 @@ public class DistributionManager
       try {
         listener.quorumLost(ev.getFailures(), ev.getRemaining());
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2661,7 +2675,7 @@ public class DistributionManager
       try {
         listener.quorumLost(ev.getFailures(), ev.getRemaining());
       } catch (CancelException e) {
-        if (closeInProgress) {
+        if (isCloseInProgress()) {
           if (logger.isTraceEnabled()) {
             logger.trace("MemberEventInvoker: cancelled");
           }
@@ -2764,7 +2778,7 @@ public class DistributionManager
           handleMemberEvent(ev);
         }
         catch (InterruptedException e) {
-          if (closeInProgress) {
+          if (isCloseInProgress()) {
             if (logger.isTraceEnabled()) {
               logger.trace("MemberEventInvoker: InterruptedException during shutdown");
             }
@@ -2778,7 +2792,7 @@ public class DistributionManager
           break;
         }
         catch (CancelException e) {
-          if (closeInProgress) {
+          if (isCloseInProgress()) {
             if (logger.isTraceEnabled()) {
               logger.trace("MemberEventInvoker: cancelled");
             }
@@ -3613,7 +3627,7 @@ public class DistributionManager
         this.stats.incNodes(-1);
       }
       StringId msg;
-      if (crashed && ! this.closeInProgress) {
+      if (crashed && ! isCloseInProgress()) {
         msg = LocalizedStrings.DistributionManager_MEMBER_AT_0_UNEXPECTEDLY_LEFT_THE_DISTRIBUTED_CACHE_1;
         addMemberEvent(new MemberCrashedEvent(theId, reason));
       } else {


Mime
View raw message