You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by pr...@apache.org on 2018/03/27 17:24:59 UTC

[geode] branch develop updated: GEODE-4520: Remove singleton CacheFactory.getAnyInstance() from o.a.g.management.internal.configuration.callbacks.

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

prhomberg 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 dde0ae7  GEODE-4520: Remove singleton CacheFactory.getAnyInstance() from o.a.g.management.internal.configuration.callbacks.
dde0ae7 is described below

commit dde0ae7a69df9c9352f6e28f21b37e21e4210140
Author: Patrick Rhomberg <pr...@pivotal.io>
AuthorDate: Tue Mar 27 10:24:56 2018 -0700

    GEODE-4520: Remove singleton CacheFactory.getAnyInstance() from o.a.g.management.internal.configuration.callbacks.
---
 .../distributed/internal/InternalClusterConfigurationService.java  | 2 +-
 .../configuration/callbacks/ConfigurationChangeListener.java       | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java
index dcd37cb..ff18923 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java
@@ -753,7 +753,7 @@ public class InternalClusterConfigurationService implements ClusterConfiguration
 
         AttributesFactory<String, Configuration> regionAttrsFactory = new AttributesFactory<>();
         regionAttrsFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
-        regionAttrsFactory.setCacheListener(new ConfigurationChangeListener(this));
+        regionAttrsFactory.setCacheListener(new ConfigurationChangeListener(this, cache));
         regionAttrsFactory.setDiskStoreName(CLUSTER_CONFIG_DISK_STORE_NAME);
         regionAttrsFactory.setScope(Scope.DISTRIBUTED_ACK);
         InternalRegionArguments internalArgs = new InternalRegionArguments();
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/callbacks/ConfigurationChangeListener.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/callbacks/ConfigurationChangeListener.java
index 7e57b47..b14019d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/callbacks/ConfigurationChangeListener.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/callbacks/ConfigurationChangeListener.java
@@ -23,7 +23,6 @@ import java.util.Set;
 import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.util.CacheListenerAdapter;
 import org.apache.geode.distributed.DistributedMember;
@@ -40,9 +39,12 @@ public class ConfigurationChangeListener extends CacheListenerAdapter<String, Co
   private static final Logger logger = LogService.getLogger();
 
   private final InternalClusterConfigurationService sharedConfig;
+  private final InternalCache cache;
 
-  public ConfigurationChangeListener(InternalClusterConfigurationService sharedConfig) {
+  public ConfigurationChangeListener(InternalClusterConfigurationService sharedConfig,
+      InternalCache cache) {
     this.sharedConfig = sharedConfig;
+    this.cache = cache;
   }
 
   // Don't process the event locally. The action of adding or removing a jar should already have
@@ -101,7 +103,6 @@ public class ConfigurationChangeListener extends CacheListenerAdapter<String, Co
   }
 
   private DistributedMember getDistributedMember(String memberName) {
-    InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
     Set<DistributedMember> locators = new HashSet<>(
         cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration().keySet());
 

-- 
To stop receiving notification emails like this one, please contact
prhomberg@apache.org.