Repository: geode Updated Branches: refs/heads/feature/GEODE-3062 9cd3ef2e1 -> 7310fd126 (forced update)
Fix bug Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/7310fd12 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/7310fd12 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/7310fd12 Branch: refs/heads/feature/GEODE-3062 Commit: 7310fd126d75e90e25492519a4415e3aaa09dba5 Parents: d15934f Author: Kirk Lund <[email protected]> Authored: Mon Jun 12 10:24:37 2017 -0700 Committer: Kirk Lund <[email protected]> Committed: Mon Jun 12 10:24:37 2017 -0700 ---------------------------------------------------------------------- .../internal/InternalDistributedSystem.java | 4 +++ .../cache/ClusterConfigurationLoader.java | 7 ++-- .../geode/internal/cache/GemFireCacheImpl.java | 34 +++++++++++++------- 3 files changed, 28 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/7310fd12/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java ---------------------------------------------------------------------- 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 22edb6f..f406393 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 @@ -516,6 +516,10 @@ public class InternalDistributedSystem extends DistributedSystem return this.securityService; } + public void setSecurityService(SecurityService securityService) { + this.securityService = securityService; + } + /** * Registers a listener to the system * http://git-wip-us.apache.org/repos/asf/geode/blob/7310fd12/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java index 4f4881f..be0dbbf 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java @@ -152,13 +152,10 @@ public class ClusterConfigurationLoader { /*** * Apply the gemfire properties cluster configuration on this member - * - * @param cache Cache created for this member - * @param response {@link ConfigurationResponse} containing the requested {@link Configuration} + * @param response {@link ConfigurationResponse} containing the requested {@link Configuration} * @param config this member's config */ - public static void applyClusterPropertiesConfiguration(Cache cache, - ConfigurationResponse response, DistributionConfig config) { + public static void applyClusterPropertiesConfiguration(ConfigurationResponse response, DistributionConfig config) { if (response == null || response.getRequestedConfiguration().isEmpty()) { return; } http://git-wip-us.apache.org/repos/asf/geode/blob/7310fd12/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java ---------------------------------------------------------------------- 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 40df0c7..f223872 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 @@ -77,6 +77,7 @@ import javax.transaction.TransactionManager; import com.sun.jna.Native; import com.sun.jna.Platform; import org.apache.commons.lang.StringUtils; +import org.apache.geode.internal.security.SecurityServiceFactory; import org.apache.logging.log4j.Logger; import org.apache.geode.CancelCriterion; @@ -126,7 +127,6 @@ import org.apache.geode.cache.client.PoolFactory; import org.apache.geode.cache.client.PoolManager; import org.apache.geode.cache.client.internal.ClientMetadataService; import org.apache.geode.cache.client.internal.ClientRegionFactoryImpl; -import org.apache.geode.cache.client.internal.ConnectionImpl; import org.apache.geode.cache.client.internal.InternalClientCache; import org.apache.geode.cache.client.internal.PoolImpl; import org.apache.geode.cache.control.ResourceManager; @@ -213,7 +213,6 @@ import org.apache.geode.internal.net.SocketCreator; import org.apache.geode.internal.offheap.MemoryAllocator; import org.apache.geode.internal.process.ClusterConfigurationNotAvailableException; import org.apache.geode.internal.security.SecurityService; -import org.apache.geode.internal.security.SecurityServiceFactory; import org.apache.geode.internal.sequencelog.SequenceLoggerImpl; import org.apache.geode.internal.tcp.ConnectionTable; import org.apache.geode.internal.util.concurrent.FutureResult; @@ -325,6 +324,8 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has private static final Pattern DOUBLE_BACKSLASH = Pattern.compile("\\\\"); + private final ConfigurationResponse configurationResponse; + /** To test MAX_QUERY_EXECUTION_TIME option. */ public int testMaxQueryExecutionTime = -1; @@ -811,7 +812,10 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has this.system = system; this.dm = this.system.getDistributionManager(); - this.securityService = this.system.getSecurityService(); + this.configurationResponse = loadClusterConfig(); + + this.securityService = SecurityServiceFactory.create(cacheConfig, this.system.getConfig()); + this.system.setSecurityService(this.securityService); if (!this.isClient && PoolManager.getAll().isEmpty()) { // We only support management on members of a distributed system @@ -931,6 +935,18 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has } // synchronized } + private ConfigurationResponse loadClusterConfig() { + // request and check cluster configuration + ConfigurationResponse configurationResponse = requestSharedConfiguration(); + deployJarsReceivedFromClusterConfiguration(configurationResponse); + + // apply the cluster's properties configuration and initialize security using that configuration + ClusterConfigurationLoader.applyClusterPropertiesConfiguration(configurationResponse, + this.system.getConfig()); + + return configurationResponse; + } + @Override public SecurityService getSecurityService() { return this.securityService; @@ -1154,13 +1170,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has ClassPathLoader.setLatestToDefault(this.system.getConfig().getDeployWorkingDir()); - // request and check cluster configuration - ConfigurationResponse configurationResponse = requestSharedConfiguration(); - deployJarsReceivedFromClusterConfiguration(configurationResponse); - - // apply the cluster's properties configuration and initialize security using that configuration - ClusterConfigurationLoader.applyClusterPropertiesConfiguration(this, configurationResponse, - this.system.getConfig()); + // Cluster Config request moved from here SystemMemberCacheEventProcessor.send(this, Operation.CACHE_CREATE); this.resourceAdvisor.initializationGate(); @@ -1184,11 +1194,11 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has boolean completedCacheXml = false; try { - if (configurationResponse == null) { + if (this.configurationResponse == null) { // Deploy all the jars from the deploy working dir. ClassPathLoader.getLatest().getJarDeployer().loadPreviouslyDeployedJarsFromDisk(); } - ClusterConfigurationLoader.applyClusterXmlConfiguration(this, configurationResponse, + ClusterConfigurationLoader.applyClusterXmlConfiguration(this,this. configurationResponse, this.system.getConfig()); initializeDeclarativeCache(); completedCacheXml = true;
