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 in my previous fix
Date Fri, 25 Sep 2015 23:24:51 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-329 d20ecb50e -> 1fcec0336


fix the hang in my previous fix


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

Branch: refs/heads/feature/GEODE-329
Commit: 1fcec0336e09db054cb4e46f5645b873359d245b
Parents: d20ecb5
Author: zhouxh <gzhou@pivotal.io>
Authored: Fri Sep 25 15:54:22 2015 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Fri Sep 25 15:54:22 2015 -0700

----------------------------------------------------------------------
 .../gemfire/distributed/DistributedSystem.java  | 52 ++++++++++----------
 1 file changed, 25 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1fcec033/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 7ea9c20..befcf1c 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,39 +1584,37 @@ public abstract class DistributedSystem implements StatisticsFactory
{
         }
 
       } else {
-        boolean existingSystemDisconnected = false;
-        do {
-          existingSystemDisconnected = false;
-          if (!existingSystems.isEmpty()) {
-            Assert.assertTrue(existingSystems.size() == 1);
+        boolean existingSystemConnected = true;
+        while (!existingSystems.isEmpty() && existingSystemConnected) {
+          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();
-                  }
+          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();
                 }
-                existingSystemDisconnected = true;
               }
+              existingSystemConnected = true;
             }
+          }
 
-            if (existingSystem.isConnected()) {
-              existingSystem.validateSameProperties(config,
-                  existingSystem.isConnected());
-              return existingSystem;
-            }
+          if (existingSystem.isConnected()) {
+            existingSystem.validateSameProperties(config,
+                existingSystem.isConnected());
+            return existingSystem;
           }
-        } while (existingSystemDisconnected && !existingSystems.isEmpty());
+        }
       }
 
       // Make a new connection to the distributed system


Mime
View raw message