You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ag...@apache.org on 2016/05/03 23:46:13 UTC

[59/60] [abbrv] incubator-geode git commit: GEODE-1329 auto-reconnect attempts cease if kicked out during boot-up of the cache

GEODE-1329 auto-reconnect attempts cease if kicked out during boot-up of the cache

This is a follow-up to the fix for GEODE-1329 that removes the old
reconnectCancelledLock variable and makes reconnectCancelled volatile.


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

Branch: refs/heads/feature/GEODE-1209
Commit: 4a6c779d386f818306062bc1a84276858592384c
Parents: b8fc3c7
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Tue May 3 13:57:47 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Tue May 3 14:00:24 2016 -0700

----------------------------------------------------------------------
 .../internal/InternalDistributedSystem.java     | 21 ++++++--------------
 1 file changed, 6 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4a6c779d/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
index df85417..91fa558 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
@@ -1445,9 +1445,7 @@ public class InternalDistributedSystem
    * the attempt has been cancelled.
    */
   public boolean isReconnectCancelled() {
-    synchronized(reconnectCancelledLock) {
-      return reconnectCancelled;
-    }
+    return reconnectCancelled;
   }
 
   /**
@@ -2476,17 +2474,14 @@ public class InternalDistributedSystem
   /**
    * If true then this DS will never reconnect.
    */
-  private boolean reconnectCancelled = false;
-  private Object reconnectCancelledLock = new Object();
+  private volatile boolean reconnectCancelled = false;
 
   /** Make sure this instance of DS never does a reconnect.
    * Also if reconnect is in progress cancel it.
    */
   public void cancelReconnect() {
 //    (new ManagerLogWriter(LogWriterImpl.FINE_LEVEL, System.out)).fine("cancelReconnect invoked", new Exception("stack trace"));
-    synchronized(this.reconnectCancelledLock) {
-      this.reconnectCancelled = true;
-    }
+    this.reconnectCancelled = true;
     if (isReconnecting()) {
       synchronized (this.reconnectLock) { // should the synchronized be first on this and
     	  // then on this.reconnectLock.
@@ -3024,10 +3019,8 @@ public class InternalDistributedSystem
       InternalDistributedSystem recon = this.reconnectDS;
 
       while (isReconnecting()) {
-        synchronized(this.reconnectCancelledLock) {
-          if (this.reconnectCancelled) {
-            break;
-          }
+        if (this.reconnectCancelled) {
+          break;
         }
         if (time != 0) {
           this.reconnectLock.wait(sleepTime);
@@ -3050,9 +3043,7 @@ public class InternalDistributedSystem
   @Override
   public void stopReconnecting() {
 //    (new ManagerLogWriter(LogWriterImpl.FINE_LEVEL, System.out)).fine("stopReconnecting invoked", new Exception("stack trace"));
-    synchronized(this.reconnectCancelledLock) {
-      this.reconnectCancelled = true;
-    }
+    this.reconnectCancelled = true;
     synchronized(this.reconnectLock) {
       this.reconnectLock.notify();
     }