You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by he...@apache.org on 2019/04/01 19:22:23 UTC

[geode] branch develop updated: GEODE-6577: performance gain by removing lazy init (#3378)

This is an automated email from the ASF dual-hosted git repository.

heybales pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new ed8b174  GEODE-6577: performance gain by removing lazy init (#3378)
ed8b174 is described below

commit ed8b17497b091e7eba55f45ae5a25632a7703389
Author: Helena Bales <hb...@pivotal.io>
AuthorDate: Mon Apr 1 12:22:06 2019 -0700

    GEODE-6577: performance gain by removing lazy init (#3378)
    
    There was lock contention for checking if the clientMetadataService
    needed to be initialized. The object is not expensive to construct, so
    the initialization has been moved the GemFireCacheImpl's constructor,
    allowing the lock object to be removed completely.
---
 .../apache/geode/internal/cache/GemFireCacheImpl.java   | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 79da8f0..63031ee 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -550,9 +550,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
 
   private final PersistentMemberManager persistentMemberManager;
 
-  private ClientMetadataService clientMetadataService = null;
-
-  private final Object clientMetaDatServiceLock = new Object();
+  private final ClientMetadataService clientMetadataService;
 
   private final AtomicBoolean isShutDownAll = new AtomicBoolean();
   private final CountDownLatch shutDownAllFinished = new CountDownLatch(1);
@@ -825,6 +823,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
                 .info("Running in local mode since no locators were specified.");
           }
         }
+
       } else {
         logger.info("Running in client mode");
         this.resourceEventsListener = null;
@@ -936,6 +935,8 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
         }
       }
     } // synchronized
+
+    clientMetadataService = new ClientMetadataService(this);
   }
 
   @Override
@@ -2022,13 +2023,9 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
 
   @Override
   public ClientMetadataService getClientMetadataService() {
-    synchronized (this.clientMetaDatServiceLock) {
-      this.stopper.checkCancelInProgress(null);
-      if (this.clientMetadataService == null) {
-        this.clientMetadataService = new ClientMetadataService(this);
-      }
-      return this.clientMetadataService;
-    }
+    this.stopper.checkCancelInProgress(null);
+
+    return this.clientMetadataService;
   }
 
   private final boolean DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE = Boolean