geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [geode] branch feature/GEODE-4582 updated: GEODE-4582 Remove singleton calls from product code
Date Tue, 05 Feb 2019 18:17:15 GMT
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch feature/GEODE-4582
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-4582 by this push:
     new 9cc7c15  GEODE-4582 Remove singleton calls from product code
9cc7c15 is described below

commit 9cc7c158cf7cec44c55058a1e105806ba4973e94
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
AuthorDate: Tue Feb 5 10:16:10 2019 -0800

    GEODE-4582 Remove singleton calls from product code
    
    Fixing a problem in GMSMembershipManager and in some test code.
---
 .../java/org/apache/geode/cache30/ReconnectDUnitTest.java           | 2 ++
 .../org/apache/geode/cache30/ReconnectWithCacheXMLDUnitTest.java    | 2 ++
 .../geode/distributed/internal/InternalDistributedSystem.java       | 2 +-
 .../geode/distributed/internal/membership/MembershipManager.java    | 5 ++++-
 .../internal/membership/gms/mgr/GMSMembershipManager.java           | 4 ++--
 .../src/main/java/org/apache/geode/internal/tcp/Connection.java     | 6 +++++-
 .../src/main/java/org/apache/geode/test/dunit/Disconnect.java       | 4 ++++
 7 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectDUnitTest.java
index b5fc42c..9a7d32f 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectDUnitTest.java
@@ -140,6 +140,7 @@ public class ReconnectDUnitTest extends JUnit4CacheTestCase {
           locatorPort = locPort;
           Properties props = getDistributedSystemProperties();
           locator = Locator.startLocatorAndDS(locatorPort, new File(""), props);
+          system = (InternalDistributedSystem) locator.getDistributedSystem();
           cache = ((InternalLocator) locator).getCache();
           ReconnectDUnitTest.savedSystem = locator.getDistributedSystem();
           IgnoredException.addIgnoredException(
@@ -563,6 +564,7 @@ public class ReconnectDUnitTest extends JUnit4CacheTestCase {
       try {
         InternalLocator locator =
             (InternalLocator) Locator.startLocatorAndDS(secondLocPort, null, props);
+        system = (InternalDistributedSystem) locator.getDistributedSystem();
         cache = locator.getCache();
       } catch (IOException e) {
         Assert.fail("exception starting locator", e);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithCacheXMLDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithCacheXMLDUnitTest.java
index 34d80fa..db50b44 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithCacheXMLDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithCacheXMLDUnitTest.java
@@ -29,6 +29,7 @@ import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.ServerLauncherParameters;
 import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.MembershipTestHook;
 import org.apache.geode.distributed.internal.membership.gms.MembershipManagerHelper;
 import org.apache.geode.internal.AvailablePortHelper;
@@ -100,6 +101,7 @@ public class ReconnectWithCacheXMLDUnitTest extends JUnit4CacheTestCase
{
         .until(() -> cache.getReconnectedCache() != null);
 
     Cache newCache = cache.getReconnectedCache();
+    system = (InternalDistributedSystem) cache.getDistributedSystem();
     CacheServer server = newCache.getCacheServers().iterator().next();
     assertEquals(ServerLauncherParameters.INSTANCE.getPort().intValue(), server.getPort());
     assertEquals(20, server.getMaxConnections()); // this setting is in the XML file
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
index 2979700..7ae729c 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
@@ -2820,7 +2820,7 @@ public class InternalDistributedSystem extends DistributedSystem
         System.setProperty(InternalLocator.INHIBIT_DM_BANNER, inhibitBanner);
       }
       if (quorumChecker != null) {
-        mbrMgr.releaseQuorumChecker(quorumChecker);
+        mbrMgr.releaseQuorumChecker(quorumChecker, reconnectDS);
       }
     }
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipManager.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipManager.java
index a91f757..4ac997f 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipManager.java
@@ -24,6 +24,7 @@ import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DMStats;
 import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 
 /**
  * A MembershipManager is responsible for reporting a MemberView, as well as having explicit
@@ -330,8 +331,10 @@ public interface MembershipManager {
    * you're all done using the quorum checker.
    *
    * @param checker the QuorumChecker instance
+   * @param distributedSystem the current distributed system
    */
-  void releaseQuorumChecker(QuorumChecker checker);
+  void releaseQuorumChecker(QuorumChecker checker,
+      InternalDistributedSystem distributedSystem);
 
   /**
    * return the coordinator for the view.
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
index 628205a..d8f3353 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
@@ -1803,9 +1803,9 @@ public class GMSMembershipManager implements MembershipManager, Manager
{
   }
 
   @Override
-  public void releaseQuorumChecker(QuorumChecker checker) {
+  public void releaseQuorumChecker(QuorumChecker checker,
+      InternalDistributedSystem system) {
     checker.suspend();
-    InternalDistributedSystem system = services.getDistributedSystem();
     if (system == null || !system.isConnected()) {
       checker.close();
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index 7f182d4..386a7a5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -1568,7 +1568,11 @@ public class Connection implements Runnable {
         logger.debug("Stopping {} for {}", p2pReaderName(), remoteAddr);
       }
       if (this.isReceiver) {
-        initiateSuspicionIfSharedUnordered();
+        try {
+          initiateSuspicionIfSharedUnordered();
+        } catch (CancelException e) {
+          // shutting down
+        }
         if (!this.sharedResource) {
           this.conduit.getStats().incThreadOwnedReceivers(-1L, dominoCount.get());
         }
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/Disconnect.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/Disconnect.java
index a0977f8..a6be437 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/Disconnect.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/Disconnect.java
@@ -18,6 +18,7 @@ import static org.apache.geode.test.dunit.Invoke.invokeInEveryVM;
 
 import org.apache.geode.admin.internal.AdminDistributedSystemImpl;
 import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.Locator;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 
@@ -49,5 +50,8 @@ public class Disconnect {
     if (ads != null) {
       ads.disconnect();
     }
+    if (Locator.hasLocator()) {
+      Locator.getLocator().stop();
+    }
   }
 }


Mime
View raw message