geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject incubator-geode git commit: fix the hang
Date Mon, 28 Sep 2015 23:37:36 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-329 1fcec0336 -> b3a3668e4


fix the hang


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

Branch: refs/heads/feature/GEODE-329
Commit: b3a3668e458bb40e0d673a743418580c0cb6dd03
Parents: 1fcec03
Author: zhouxh <gzhou@pivotal.io>
Authored: Mon Sep 28 16:27:17 2015 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Mon Sep 28 16:27:17 2015 -0700

----------------------------------------------------------------------
 .../gemfire/distributed/DistributedSystem.java  | 39 ++++++++++----------
 1 file changed, 19 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b3a3668e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
index befcf1c..21be43f 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
@@ -1584,35 +1584,34 @@ public abstract class DistributedSystem implements StatisticsFactory
{
         }
 
       } else {
-        boolean existingSystemConnected = true;
-        while (!existingSystems.isEmpty() && existingSystemConnected) {
+        boolean existingSystemDisconnecting = true;
+        while (!existingSystems.isEmpty() && existingSystemDisconnecting) {
           Assert.assertTrue(existingSystems.size() == 1);
-          existingSystemConnected = false;
 
           InternalDistributedSystem existingSystem =
               (InternalDistributedSystem) existingSystems.get(0);
-          if (existingSystem.isDisconnecting()) {
-            while (existingSystem.isConnected()) {
-              boolean interrupted = Thread.interrupted();
-              try {
-                existingSystemsLock.wait(500);
-              } 
-              catch (InterruptedException ex) {
-                interrupted = true;
-              }
-              finally {
-                if (interrupted) {
-                  Thread.currentThread().interrupt();
-                }
+          existingSystemDisconnecting = existingSystem.isDisconnecting();
+          if (existingSystemDisconnecting) {
+            boolean interrupted = Thread.interrupted();
+            try {
+              // no notify for existingSystemsLock, just to release the sync
+              existingSystemsLock.wait(50);
+            } 
+            catch (InterruptedException ex) {
+              interrupted = true;
+            }
+            finally {
+              if (interrupted) {
+                Thread.currentThread().interrupt();
               }
-              existingSystemConnected = true;
             }
-          }
-
-          if (existingSystem.isConnected()) {
+          } else if (existingSystem.isConnected()) {
             existingSystem.validateSameProperties(config,
                 existingSystem.isConnected());
             return existingSystem;
+          } else {
+          // This should not happen: existingSystem.isConnected()==false && existingSystem.isDisconnecting()==false

+            throw new AssertionError("system should not be disconnecting==false and isConnected==falsed");
           }
         }
       }


Mime
View raw message