You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2020/07/02 18:10:55 UTC
[geode] 19/29: GEODE-8294 - Integrate ModuleService into
ServerConnectionfactory.
This is an automated email from the ASF dual-hosted git repository.
udo pushed a commit to branch feature/GEODE-8294
in repository https://gitbox.apache.org/repos/asf/geode.git
commit cc2a870d04931431bc863893b03e1d5e54c206b4
Author: Patrick Johnson <pj...@pivotal.io>
AuthorDate: Wed Jun 24 16:46:47 2020 -0700
GEODE-8294 - Integrate ModuleService into ServerConnectionfactory.
---
...ReconnectWithClusterConfigurationDUnitTest.java | 3 +-
.../AutoConnectionSourceImplJUnitTest.java | 12 +-
.../internal/InternalLocatorIntegrationTest.java | 15 +-
.../internal/membership/MembershipJUnitTest.java | 4 +-
.../tier/sockets/AcceptorImplIntegrationTest.java | 3 +-
.../api/LoggingWithLocatorIntegrationTest.java | 7 +-
.../java/org/apache/geode/distributed/Locator.java | 85 ++++---
.../apache/geode/distributed/LocatorLauncher.java | 3 +-
.../internal/InternalDistributedSystem.java | 2 +-
.../distributed/internal/InternalLocator.java | 37 +--
.../apache/geode/internal/DistributionLocator.java | 4 +-
.../geode/internal/cache/CacheServerImpl.java | 257 ++++++++++-----------
.../protocol/ClientProtocolServiceLoader.java | 15 +-
.../tier/sockets/ServerConnectionFactory.java | 5 +-
.../distributed/internal/InternalLocatorTest.java | 7 +-
.../geode/internal/cache/CacheServerImplTest.java | 2 +
.../geode/internal/cache/GemFireCacheImplTest.java | 13 +-
.../tier/sockets/ServerConnectionFactoryTest.java | 13 +-
.../cache/tier/sockets/ServerConnectionTest.java | 4 +-
.../membership/gms/MembershipIntegrationTest.java | 2 +-
20 files changed, 252 insertions(+), 241 deletions(-)
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithClusterConfigurationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithClusterConfigurationDUnitTest.java
index 1c8f92c..5fa6cfa 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithClusterConfigurationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithClusterConfigurationDUnitTest.java
@@ -52,6 +52,7 @@ import org.apache.geode.distributed.internal.membership.api.MembershipManagerHel
import org.apache.geode.internal.AvailablePort;
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.inet.LocalHostUtil;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.awaitility.GeodeAwaitility;
import org.apache.geode.test.dunit.Assert;
import org.apache.geode.test.dunit.AsyncInvocation;
@@ -98,7 +99,7 @@ public class ReconnectWithClusterConfigurationDUnitTest implements Serializable
Properties props = getDistributedSystemProperties();
locator = InternalLocator.startLocator(locatorPorts[locatorNumber], new File(""),
null, null, LocalHostUtil.getLocalHost(), true,
- props, null, Paths.get(workingDir));
+ props, null, Paths.get(workingDir), ModuleService.DEFAULT);
system = locator.getDistributedSystem();
cache = ((InternalLocator) locator).getCache();
IgnoredException.addIgnoredException(
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
index 5e783cb..50f9672 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
@@ -83,6 +83,7 @@ import org.apache.geode.internal.net.SocketCreatorFactory;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.management.membership.ClientMembershipEvent;
import org.apache.geode.management.membership.ClientMembershipListener;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.junit.categories.ClientServerTest;
import org.apache.geode.util.internal.GeodeGlossary;
@@ -90,6 +91,8 @@ import org.apache.geode.util.internal.GeodeGlossary;
@Category(ClientServerTest.class)
public class AutoConnectionSourceImplJUnitTest {
+ @Rule
+ public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
private Cache cache;
private int port;
private FakeHandler handler;
@@ -99,9 +102,6 @@ public class AutoConnectionSourceImplJUnitTest {
private ScheduledExecutorService background;
private PoolStats poolStats;
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
@Before
public void setUp() throws Exception {
Properties props = new Properties();
@@ -299,7 +299,8 @@ public class AutoConnectionSourceImplJUnitTest {
TcpServer server2 =
new TcpServer(secondPort, InetAddress.getLocalHost(), handler,
- "tcp server", new ProtocolCheckerImpl(null, new ClientProtocolServiceLoader()),
+ "tcp server", new ProtocolCheckerImpl(null, new ClientProtocolServiceLoader(
+ ModuleService.DEFAULT)),
DistributionStats::getStatTime,
Executors::newCachedThreadPool,
SocketCreatorFactory
@@ -386,7 +387,8 @@ public class AutoConnectionSourceImplJUnitTest {
private void startFakeLocator() throws IOException, InterruptedException {
server = new TcpServer(port, InetAddress.getLocalHost(), handler,
- "Tcp Server", new ProtocolCheckerImpl(null, new ClientProtocolServiceLoader()),
+ "Tcp Server",
+ new ProtocolCheckerImpl(null, new ClientProtocolServiceLoader(ModuleService.DEFAULT)),
DistributionStats::getStatTime,
Executors::newCachedThreadPool,
SocketCreatorFactory
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorIntegrationTest.java
index 09efe36..eecda74 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorIntegrationTest.java
@@ -40,6 +40,7 @@ import org.apache.geode.distributed.Locator;
import org.apache.geode.internal.logging.InternalLogWriter;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.logging.internal.LoggingSession;
+import org.apache.geode.services.module.ModuleService;
public class InternalLocatorIntegrationTest {
@@ -99,7 +100,7 @@ public class InternalLocatorIntegrationTest {
internalLocator =
new InternalLocator(port, loggingSession, logFile, logWriter, securityLogWriter,
bindAddress, hostnameForClients, distributedSystemProperties, distributionConfig,
- workingDirectory);
+ workingDirectory, ModuleService.DEFAULT);
}).doesNotThrowAnyException();
}
@@ -107,7 +108,7 @@ public class InternalLocatorIntegrationTest {
public void restartingClusterConfigurationDoesNotThrowException() throws IOException {
internalLocator = InternalLocator.startLocator(port, logFile, logWriter,
securityLogWriter, bindAddress, true,
- distributedSystemProperties, hostnameForClients, workingDirectory);
+ distributedSystemProperties, hostnameForClients, workingDirectory, ModuleService.DEFAULT);
port = internalLocator.getPort();
internalLocator.stop(true, true, false);
assertThat(InternalLocator.getLocator()).isNull();
@@ -121,7 +122,7 @@ public class InternalLocatorIntegrationTest {
public void startedLocatorIsRunning() throws IOException {
internalLocator = InternalLocator.startLocator(port, logFile, logWriter,
securityLogWriter, bindAddress, true,
- distributedSystemProperties, hostnameForClients, workingDirectory);
+ distributedSystemProperties, hostnameForClients, workingDirectory, ModuleService.DEFAULT);
port = internalLocator.getPort();
assertThat(internalLocator.isStopped()).isFalse();
@@ -131,7 +132,7 @@ public class InternalLocatorIntegrationTest {
public void startedLocatorHasLocator() throws IOException {
internalLocator = InternalLocator.startLocator(port, logFile, logWriter,
securityLogWriter, bindAddress, true,
- distributedSystemProperties, hostnameForClients, workingDirectory);
+ distributedSystemProperties, hostnameForClients, workingDirectory, ModuleService.DEFAULT);
port = internalLocator.getPort();
assertThat(InternalLocator.hasLocator()).isTrue();
@@ -141,7 +142,7 @@ public class InternalLocatorIntegrationTest {
public void stoppedLocatorIsStopped() throws IOException {
internalLocator = InternalLocator.startLocator(port, logFile, logWriter,
securityLogWriter, bindAddress, true,
- distributedSystemProperties, hostnameForClients, workingDirectory);
+ distributedSystemProperties, hostnameForClients, workingDirectory, ModuleService.DEFAULT);
port = internalLocator.getPort();
internalLocator.stop();
@@ -153,7 +154,7 @@ public class InternalLocatorIntegrationTest {
public void stoppedLocatorDoesNotHaveLocator() throws IOException {
internalLocator = InternalLocator.startLocator(port, logFile, logWriter,
securityLogWriter, bindAddress, true,
- distributedSystemProperties, hostnameForClients, workingDirectory);
+ distributedSystemProperties, hostnameForClients, workingDirectory, ModuleService.DEFAULT);
port = internalLocator.getPort();
internalLocator.stop();
@@ -172,7 +173,7 @@ public class InternalLocatorIntegrationTest {
properties.put("load-cluster-configuration-from-dir", "true");
assertThatThrownBy(() -> InternalLocator.startLocator(port, logFile, logWriter,
securityLogWriter, bindAddress, true,
- properties, hostnameForClients, workingDirectory)).isInstanceOf(RuntimeException.class);
+ properties, hostnameForClients, workingDirectory, ModuleService.DEFAULT)).isInstanceOf(RuntimeException.class);
assertThat(InternalLocator.hasLocator()).isFalse();
}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
index 688fd10..6697b21 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
@@ -144,7 +144,7 @@ public class MembershipJUnitTest {
// to be created
internalLocator =
InternalLocator.startLocator(port, new File(""), null, null, localHost, false,
- new Properties(), null, temporaryFolder.getRoot().toPath());
+ new Properties(), null, temporaryFolder.getRoot().toPath(), ModuleService.DEFAULT);
// create configuration objects
Properties nonDefault = new Properties();
@@ -337,7 +337,7 @@ public class MembershipJUnitTest {
// to be created
internalLocator =
InternalLocator.startLocator(port, new File(""), null, null, localHost, false, p, null,
- temporaryFolder.getRoot().toPath());
+ temporaryFolder.getRoot().toPath(), ModuleService.DEFAULT);
// create configuration objects
Properties nonDefault = new Properties();
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImplIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImplIntegrationTest.java
index ba7aa70..3fec244 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImplIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImplIntegrationTest.java
@@ -40,6 +40,7 @@ import org.junit.experimental.categories.Category;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.tier.Acceptor;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.junit.categories.ClientServerTest;
@Category(ClientServerTest.class)
@@ -53,7 +54,7 @@ public class AcceptorImplIntegrationTest {
@Before
public void setUp() throws Exception {
cache = (InternalCache) new CacheFactory().create();
- serverConnectionFactory = new ServerConnectionFactory();
+ serverConnectionFactory = new ServerConnectionFactory(ModuleService.DEFAULT);
}
@After
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/logging/internal/api/LoggingWithLocatorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/logging/internal/api/LoggingWithLocatorIntegrationTest.java
index 91d3691..b9711fc 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/logging/internal/api/LoggingWithLocatorIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/logging/internal/api/LoggingWithLocatorIntegrationTest.java
@@ -44,6 +44,7 @@ import org.apache.geode.internal.AvailablePort;
import org.apache.geode.logging.internal.log4j.LogWriterLogger;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.logging.internal.spi.LogConfig;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.assertj.LogFileAssert;
import org.apache.geode.test.junit.categories.LoggingTest;
@@ -92,7 +93,7 @@ public class LoggingWithLocatorIntegrationTest {
Properties config = new Properties();
locator = InternalLocator.startLocator(port, null, null, null, null, false, config, null,
- temporaryFolder.getRoot().toPath());
+ temporaryFolder.getRoot().toPath(), ModuleService.DEFAULT);
LogConfig logConfig = locator.getLogConfig();
@@ -111,7 +112,7 @@ public class LoggingWithLocatorIntegrationTest {
Properties config = new Properties();
locator = InternalLocator.startLocator(port, logFile, null, null, null, false, config, null,
- temporaryFolder.getRoot().toPath());
+ temporaryFolder.getRoot().toPath(), ModuleService.DEFAULT);
LogConfig logConfig = locator.getLogConfig();
@@ -169,7 +170,7 @@ public class LoggingWithLocatorIntegrationTest {
config.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
locator = InternalLocator.startLocator(port, null, null, null, null, false, config, null,
- temporaryFolder.getRoot().toPath());
+ temporaryFolder.getRoot().toPath(), ModuleService.DEFAULT);
Logger logger = LogService.getLogger();
// assert that logging goes to logFile
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/Locator.java b/geode-core/src/main/java/org/apache/geode/distributed/Locator.java
index e4b2c98..9da28f4 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/Locator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/Locator.java
@@ -23,6 +23,7 @@ import java.util.Properties;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.inet.LocalHostUtil;
+import org.apache.geode.services.module.ModuleService;
/**
* Represents a distribution locator server that provides discovery information to members and
@@ -250,7 +251,7 @@ public abstract class Locator {
java.util.Properties dsProperties, boolean peerLocator, boolean serverLocator,
String hostnameForClients) throws IOException {
return InternalLocator.startLocator(port, logFile, null, null, bindAddress, true, dsProperties,
- hostnameForClients);
+ hostnameForClients, ModuleService.DEFAULT);
}
/**
@@ -261,7 +262,7 @@ public abstract class Locator {
InetAddress bindAddress, java.util.Properties dsProperties, boolean peerLocator,
boolean serverLocator, String hostnameForClients) throws IOException {
return InternalLocator.startLocator(port, logFile, null, null, bindAddress,
- startDistributedSystem, dsProperties, hostnameForClients);
+ startDistributedSystem, dsProperties, hostnameForClients, ModuleService.DEFAULT);
}
/**
@@ -311,6 +312,45 @@ public abstract class Locator {
///////////////////// Instance Methods /////////////////////
/**
+ * Starts a distribution locator from the command line.
+ * <p>
+ * This method of starting the locator is provided as an alternative to the <i>gemfire
+ * start-locator</i> command to give you complete control over the java virtual machine's
+ * configuration.
+ * <p>
+ * The <i>gemfire stop-locator</i> command can be used to stop a locator that is started with this
+ * class.
+ * <p>
+ * java org.apache.geode.distributed.Locator port [bind-address] [gemfire-properties-file] [peer]
+ * [server]
+ * <p>
+ * port - the tcp/ip port that the locator should listen on. This is the port number that
+ * applications will refer to in their <i>locators</i> property in gemfire.properties
+ * <p>
+ * bind-address - the tcp/ip address that the locator should bind to. This can be missing or be an
+ * empty string, which causes the locator to listen on all host addresses.
+ * <p>
+ * gemfire-properties-file - the location of a gemfire.properties file to be used in configuring
+ * the locator's distributed system. This can be missing or be an empty string, which will cause
+ * the locator to use the default search for gemfire.properties.
+ * <p>
+ * peer - true to start the peer locator service, false to disable it. If unspecified, default to
+ * true.
+ * <p>
+ * server - true to start the cache server locator service, false to disable it. If unspecified,
+ * defaults to true.
+ * <p>
+ * hostname-for-clients - the ip address or host name that clients will be told to use to connect
+ * to this locator. If unspecified, defaults to the bind-address.
+ *
+ * @deprecated as of Geode 1.4 use {@link org.apache.geode.distributed.LocatorLauncher
+ * "LocatorLauncher" to start a locator}
+ */
+ public static void main(String args[]) {
+ org.apache.geode.internal.DistributionLocator.main(args);
+ }
+
+ /**
* Returns the port on which this locator runs
*/
public abstract Integer getPort();
@@ -320,7 +360,6 @@ public abstract class Locator {
*/
public abstract DistributedSystem getDistributedSystem();
-
/**
* Returns the log file to which this locator's output is written
*/
@@ -363,7 +402,6 @@ public abstract class Locator {
*/
public abstract boolean isServerLocator();
-
/**
* Stops this distribution locator.
*/
@@ -397,43 +435,4 @@ public abstract class Locator {
return locatorString.toString();
}
- /**
- * Starts a distribution locator from the command line.
- * <p>
- * This method of starting the locator is provided as an alternative to the <i>gemfire
- * start-locator</i> command to give you complete control over the java virtual machine's
- * configuration.
- * <p>
- * The <i>gemfire stop-locator</i> command can be used to stop a locator that is started with this
- * class.
- * <p>
- * java org.apache.geode.distributed.Locator port [bind-address] [gemfire-properties-file] [peer]
- * [server]
- * <p>
- * port - the tcp/ip port that the locator should listen on. This is the port number that
- * applications will refer to in their <i>locators</i> property in gemfire.properties
- * <p>
- * bind-address - the tcp/ip address that the locator should bind to. This can be missing or be an
- * empty string, which causes the locator to listen on all host addresses.
- * <p>
- * gemfire-properties-file - the location of a gemfire.properties file to be used in configuring
- * the locator's distributed system. This can be missing or be an empty string, which will cause
- * the locator to use the default search for gemfire.properties.
- * <p>
- * peer - true to start the peer locator service, false to disable it. If unspecified, default to
- * true.
- * <p>
- * server - true to start the cache server locator service, false to disable it. If unspecified,
- * defaults to true.
- * <p>
- * hostname-for-clients - the ip address or host name that clients will be told to use to connect
- * to this locator. If unspecified, defaults to the bind-address.
- *
- * @deprecated as of Geode 1.4 use {@link org.apache.geode.distributed.LocatorLauncher
- * "LocatorLauncher" to start a locator}
- */
- public static void main(String args[]) {
- org.apache.geode.internal.DistributionLocator.main(args);
- }
-
}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index 21294a22..c2ad292 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -91,6 +91,7 @@ import org.apache.geode.lang.AttachAPINotFoundException;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.management.internal.util.HostUtils;
import org.apache.geode.management.internal.util.JsonUtil;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.util.internal.GeodeGlossary;
/**
@@ -715,7 +716,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
try {
this.locator = InternalLocator.startLocator(getPort(), getLogFile(), null, null,
getBindAddress(), true, getDistributedSystemProperties(), getHostnameForClients(),
- Paths.get(workingDirectory));
+ Paths.get(workingDirectory), ModuleService.DEFAULT);
} finally {
ProcessLauncherContext.remove();
}
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 171610c..b8b2507 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
@@ -926,7 +926,7 @@ public class InternalDistributedSystem extends DistributedSystem
startedLocator =
InternalLocator.createLocator(locId.getPort(), NullLoggingSession.create(), null,
logWriter, securityLogWriter, locId.getHost().getAddress(),
- locId.getHostnameForClients(), originalConfig.toProperties(), false);
+ locId.getHostnameForClients(), originalConfig.toProperties(), false, moduleService);
// if locator is started this way, cluster config is not enabled, set the flag correctly
startedLocator.getConfig().setEnableClusterConfiguration(false);
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index e3fa7c3..f4d8835 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -202,6 +202,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
private WanLocatorDiscoverer locatorDiscoverer;
private InternalConfigurationPersistenceService configurationPersistenceService;
private ClusterManagementService clusterManagementService;
+ private ModuleService moduleService;
/**
* Creates a new {@code Locator} with the given port, log file, logWriter, and bind address.
@@ -220,7 +221,9 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
InternalLocator(int port, LoggingSession loggingSession, File logFile,
InternalLogWriter logWriter, InternalLogWriter securityLogWriter, InetAddress bindAddress,
String hostnameForClients, Properties distributedSystemProperties,
- DistributionConfigImpl distributionConfig, Path workingDirectory) {
+ DistributionConfigImpl distributionConfig, Path workingDirectory,
+ ModuleService moduleService) {
+ this.moduleService = moduleService;
this.logFile = logFile;
this.bindAddress = bindAddress;
this.hostnameForClients = hostnameForClients;
@@ -280,7 +283,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
SocketCreatorFactory.setDistributionConfig(this.distributionConfig);
locatorListener = WANServiceProvider
- .createLocatorMembershipListener(internalDistributedSystem.getModuleService());
+ .createLocatorMembershipListener(moduleService);
if (locatorListener != null) {
// We defer setting the port until the handler is init'd - that way we'll have an actual port
// in the case where we're starting with port = 0.
@@ -310,7 +313,8 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
.setConfig(config)
.setPort(port)
.setBindAddress(bindAddress)
- .setProtocolChecker(new ProtocolCheckerImpl(this, new ClientProtocolServiceLoader()))
+ .setProtocolChecker(new ProtocolCheckerImpl(this,
+ new ClientProtocolServiceLoader(moduleService)))
.setFallbackHandler(handler)
.setLocatorsAreCoordinators(shouldLocatorsBeCoordinators())
.setLocatorStats(locatorStats)
@@ -381,17 +385,17 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
* @param startDistributedSystem if true then this locator will also start its own ds
*
* @deprecated Please use
- * {@link #createLocator(int, LoggingSession, File, InternalLogWriter, InternalLogWriter, InetAddress, String, Properties, Path)}
+ * {@link #createLocator(int, LoggingSession, File, InternalLogWriter, InternalLogWriter, InetAddress, String, Properties, Path, ModuleService)}
* instead.
*/
@Deprecated
public static InternalLocator createLocator(int port, LoggingSession loggingSession, File logFile,
InternalLogWriter logWriter, InternalLogWriter securityLogWriter, InetAddress bindAddress,
String hostnameForClients, Properties distributedSystemProperties,
- boolean startDistributedSystem) {
+ boolean startDistributedSystem, ModuleService moduleService) {
return createLocator(port, loggingSession, logFile, logWriter, securityLogWriter, bindAddress,
hostnameForClients, distributedSystemProperties,
- Paths.get(System.getProperty("user.dir")));
+ Paths.get(System.getProperty("user.dir")), moduleService);
}
/**
@@ -411,7 +415,8 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
*/
public static InternalLocator createLocator(int port, LoggingSession loggingSession, File logFile,
InternalLogWriter logWriter, InternalLogWriter securityLogWriter, InetAddress bindAddress,
- String hostnameForClients, Properties distributedSystemProperties, Path workingDirectory) {
+ String hostnameForClients, Properties distributedSystemProperties, Path workingDirectory,
+ ModuleService moduleService) {
synchronized (locatorLock) {
if (hasLocator()) {
throw new IllegalStateException(
@@ -420,7 +425,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
InternalLocator locator =
new InternalLocator(port, loggingSession, logFile, logWriter, securityLogWriter,
bindAddress, hostnameForClients, distributedSystemProperties, null,
- workingDirectory);
+ workingDirectory, moduleService);
InternalLocator.locator = locator;
return locator;
}
@@ -445,11 +450,12 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
*/
public static InternalLocator startLocator(int port, File logFile, InternalLogWriter logWriter,
InternalLogWriter securityLogWriter, InetAddress bindAddress, boolean startDistributedSystem,
- Properties distributedSystemProperties, String hostnameForClients)
+ Properties distributedSystemProperties, String hostnameForClients,
+ ModuleService moduleService)
throws IOException {
return startLocator(port, logFile, logWriter, securityLogWriter, bindAddress,
startDistributedSystem, distributedSystemProperties, hostnameForClients,
- Paths.get(System.getProperty("user.dir")));
+ Paths.get(System.getProperty("user.dir")), moduleService);
}
/**
@@ -472,7 +478,8 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
*/
public static InternalLocator startLocator(int port, File logFile, InternalLogWriter logWriter,
InternalLogWriter securityLogWriter, InetAddress bindAddress, boolean startDistributedSystem,
- Properties distributedSystemProperties, String hostnameForClients, Path workingDirectory)
+ Properties distributedSystemProperties, String hostnameForClients, Path workingDirectory,
+ ModuleService moduleService)
throws IOException {
System.setProperty(FORCE_LOCATOR_DM_TYPE, "true");
InternalLocator newLocator = null;
@@ -486,7 +493,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
newLocator = createLocator(port, loggingSession, logFile, logWriter, securityLogWriter,
bindAddress, hostnameForClients, distributedSystemProperties,
- workingDirectory);
+ workingDirectory, moduleService);
loggingSession.createSession(newLocator);
loggingSession.startSession();
@@ -571,9 +578,9 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
public static InternalLocator startLocator(int locatorPort, File logFile,
InternalLogWriter logWriter, InternalLogWriter securityLogWriter, InetAddress bindAddress,
Properties distributedSystemProperties, boolean peerLocator, boolean serverLocator,
- String hostnameForClients, boolean b1) throws IOException {
+ String hostnameForClients, boolean b1, ModuleService moduleService) throws IOException {
return startLocator(locatorPort, logFile, logWriter, securityLogWriter, bindAddress, true,
- distributedSystemProperties, hostnameForClients);
+ distributedSystemProperties, hostnameForClients, moduleService);
}
/**
@@ -751,7 +758,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
InternalDistributedSystem
.connectInternal(distributedSystemProperties, null,
new InternalDistributedSystemMetricsService.Builder(),
- ModuleService.DEFAULT,
+ moduleService,
membershipLocator);
if (peerLocator) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DistributionLocator.java b/geode-core/src/main/java/org/apache/geode/internal/DistributionLocator.java
index 731459c..936b0a5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DistributionLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DistributionLocator.java
@@ -28,6 +28,7 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.logging.internal.executors.LoggingThread;
import org.apache.geode.logging.internal.log4j.api.LogService;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.util.internal.GeodeGlossary;
/**
@@ -153,7 +154,8 @@ public class DistributionLocator {
try {
InternalLocator locator = InternalLocator.startLocator(port, new File(DEFAULT_LOG_FILE),
- null, null, address, true, (Properties) null, hostnameForClients);
+ null, null, address, true, (Properties) null, hostnameForClients,
+ ModuleService.DEFAULT);
ManagerInfo.setLocatorStarted(directory, port, address);
locator.waitToStop();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
index 19d262e..775c966 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
@@ -87,49 +87,44 @@ import org.apache.geode.util.internal.GeodeGlossary;
*/
@SuppressWarnings("deprecation")
public class CacheServerImpl extends AbstractCacheServer implements DistributionAdvisee {
+ public static final boolean ENABLE_NOTIFY_BY_SUBSCRIPTION_FALSE = Boolean.getBoolean(
+ GeodeGlossary.GEMFIRE_PREFIX + "cache-server.enable-notify-by-subscription-false");
+ static final String CACHE_SERVER_BIND_ADDRESS_NOT_AVAILABLE_EXCEPTION_MESSAGE =
+ "A cache server's bind address is only available if it has been started";
private static final Logger logger = LogService.getLogger();
-
private static final int FORCE_LOAD_UPDATE_FREQUENCY = getInteger(
GeodeGlossary.GEMFIRE_PREFIX + "BridgeServer.FORCE_LOAD_UPDATE_FREQUENCY", 10);
-
- static final String CACHE_SERVER_BIND_ADDRESS_NOT_AVAILABLE_EXCEPTION_MESSAGE =
- "A cache server's bind address is only available if it has been started";
-
+ @MakeNotStatic
+ private static final AtomicInteger profileSN = new AtomicInteger();
private final SecurityService securityService;
-
private final StatisticsClock statisticsClock;
-
private final AcceptorBuilder acceptorBuilder;
-
private final boolean sendResourceEvents;
-
private final boolean includeMembershipGroups;
-
/**
* The server connection factory, that provides a {@link ServerConnection}.
*/
- private final ServerConnectionFactory serverConnectionFactory = new ServerConnectionFactory();
-
+ private final ServerConnectionFactory serverConnectionFactory;
+ private final Supplier<SocketCreator> socketCreatorSupplier;
+ private final CacheClientNotifierProvider cacheClientNotifierProvider;
+ private final ClientHealthMonitorProvider clientHealthMonitorProvider;
+ private final Function<DistributionAdvisee, CacheServerAdvisor> cacheServerAdvisorProvider;
/** The acceptor that does the actual serving */
private volatile Acceptor acceptor;
-
/**
* The advisor used by this cache server.
*
* @since GemFire 5.7
*/
private volatile CacheServerAdvisor advisor;
-
/**
* The monitor used to monitor load on this cache server and distribute load to the locators
*
* @since GemFire 5.7
*/
private volatile LoadMonitor loadMonitor;
-
/** is this a server created by a launcher as opposed to by an application or XML? */
private boolean isDefaultServer;
-
/**
* Needed because this server is an advisee
*
@@ -137,14 +132,6 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
*/
private int serialNumber; // changed on each start
- private final Supplier<SocketCreator> socketCreatorSupplier;
- private final CacheClientNotifierProvider cacheClientNotifierProvider;
- private final ClientHealthMonitorProvider clientHealthMonitorProvider;
- private final Function<DistributionAdvisee, CacheServerAdvisor> cacheServerAdvisorProvider;
-
- public static final boolean ENABLE_NOTIFY_BY_SUBSCRIPTION_FALSE = Boolean.getBoolean(
- GeodeGlossary.GEMFIRE_PREFIX + "cache-server.enable-notify-by-subscription-false");
-
CacheServerImpl(final InternalCache cache,
final SecurityService securityService,
final StatisticsClock statisticsClock,
@@ -165,6 +152,104 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
this.cacheClientNotifierProvider = cacheClientNotifierProvider;
this.clientHealthMonitorProvider = clientHealthMonitorProvider;
this.cacheServerAdvisorProvider = cacheServerAdvisorProvider;
+ this.serverConnectionFactory =
+ new ServerConnectionFactory(cache.getInternalDistributedSystem().getModuleService());
+ }
+
+ /**
+ * create client subscription
+ *
+ * @return client subscription name
+ * @since GemFire 5.7
+ */
+ public static String clientMessagesRegion(InternalCache cache, String ePolicy, int capacity,
+ int port, String overFlowDir, boolean isDiskStore) {
+ InternalRegionFactory factory =
+ getRegionFactoryForClientMessagesRegion(cache, ePolicy, capacity, overFlowDir, isDiskStore);
+ return createClientMessagesRegion(factory, port);
+ }
+
+ private static InternalRegionFactory getRegionFactoryForClientMessagesRegion(InternalCache cache,
+ String ePolicy, int capacity, String overflowDir, boolean isDiskStore)
+ throws InvalidValueException, GemFireIOException {
+ InternalRegionFactory factory = cache.createInternalRegionFactory();
+ factory.setScope(Scope.LOCAL);
+
+ if (isDiskStore) {
+ // overflowDir parameter is actually diskstore name
+ factory.setDiskStoreName(overflowDir);
+ // client subscription queue is always overflow to disk, so do async
+ // see feature request #41479
+ factory.setDiskSynchronous(true);
+ } else if (overflowDir == null
+ || overflowDir.equals(ClientSubscriptionConfig.DEFAULT_OVERFLOW_DIRECTORY)) {
+ factory.setDiskStoreName(null);
+ // client subscription queue is always overflow to disk, so do async
+ // see feature request #41479
+ factory.setDiskSynchronous(true);
+ } else {
+ File dir = new File(
+ overflowDir + File.separatorChar + generateNameForClientMsgsRegion(OSProcess.getId()));
+ // This will delete the overflow directory when virtual machine terminates.
+ dir.deleteOnExit();
+ if (!dir.mkdirs() && !dir.isDirectory()) {
+ throw new GemFireIOException(
+ "Could not create client subscription overflow directory: " + dir.getAbsolutePath());
+ }
+ File[] dirs = {dir};
+
+ DiskStoreFactory dsf = cache.createDiskStoreFactory();
+ dsf.setAutoCompact(true).setDiskDirsAndSizes(dirs, new int[] {MAX_VALUE}).create("bsi");
+
+ factory.setDiskStoreName("bsi");
+ // backward compatibility, it was sync
+ factory.setDiskSynchronous(true);
+ }
+ factory.setDataPolicy(DataPolicy.NORMAL);
+ // enable statistics
+ factory.setStatisticsEnabled(true);
+ /* setting LIFO related eviction attributes */
+ if (HARegionQueue.HA_EVICTION_POLICY_ENTRY.equals(ePolicy)) {
+ factory.setEvictionAttributes(
+ EvictionAttributes.createLIFOEntryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
+ } else if (HARegionQueue.HA_EVICTION_POLICY_MEMORY.equals(ePolicy)) {
+ // condition refinement
+ factory.setEvictionAttributes(
+ EvictionAttributes.createLIFOMemoryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
+ } else {
+ // throw invalid eviction policy exception
+ throw new InvalidValueException(
+ String.format("%s Invalid eviction policy", ePolicy));
+ }
+ return factory;
+ }
+
+ private static String createClientMessagesRegion(InternalRegionFactory factory, int port) {
+ // generating unique name in VM for ClientMessagesRegion
+ String regionName = generateNameForClientMsgsRegion(port);
+ try {
+ factory.setDestroyLockFlag(true).setRecreateFlag(false)
+ .setSnapshotInputStream(null).setImageTarget(null).setIsUsedForMetaRegion(true);
+ factory.create(regionName);
+ } catch (RegionExistsException ree) {
+ InternalGemFireError assErr = new InternalGemFireError("unexpected exception");
+ assErr.initCause(ree);
+ throw assErr;
+ }
+ return regionName;
+ }
+
+ /**
+ * Generates the name for the client subscription using the given id.
+ *
+ * @since GemFire 5.7
+ */
+ public static String generateNameForClientMsgsRegion(int id) {
+ return ClientSubscriptionConfigImpl.CLIENT_SUBSCRIPTION + "_" + id;
+ }
+
+ private static int createSerialNumber() {
+ return profileSN.incrementAndGet();
}
@Override
@@ -236,9 +321,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
@Override
- public void setMaximumMessageCount(int maximumMessageCount) {
- checkRunning();
- super.setMaximumMessageCount(maximumMessageCount);
+ public int getSocketBufferSize() {
+ return this.socketBufferSize;
}
@Override
@@ -247,8 +331,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
@Override
- public int getSocketBufferSize() {
- return this.socketBufferSize;
+ public int getMaximumTimeBetweenPings() {
+ return this.maximumTimeBetweenPings;
}
@Override
@@ -257,12 +341,6 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
@Override
- public int getMaximumTimeBetweenPings() {
- return this.maximumTimeBetweenPings;
- }
-
-
- @Override
public void setLoadPollInterval(long loadPollInterval) {
checkRunning();
super.setLoadPollInterval(loadPollInterval);
@@ -274,6 +352,12 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
@Override
+ public void setMaximumMessageCount(int maximumMessageCount) {
+ checkRunning();
+ super.setMaximumMessageCount(maximumMessageCount);
+ }
+
+ @Override
public void setLoadProbe(ServerLoadProbe loadProbe) {
checkRunning();
super.setLoadProbe(loadProbe);
@@ -437,6 +521,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return getExternalAddress(true);
}
+ // DistributionAdvisee methods
+
public String getExternalAddress(boolean checkServerRunning) {
if (checkServerRunning) {
if (!this.isRunning()) {
@@ -561,8 +647,6 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return this.acceptor;
}
- // DistributionAdvisee methods
-
@Override
public DistributionManager getDistributionManager() {
return getSystem().getDistributionManager();
@@ -583,98 +667,6 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return new HashSet(getCacheClientNotifier().getClientProxies());
}
- /**
- * create client subscription
- *
- * @return client subscription name
- * @since GemFire 5.7
- */
- public static String clientMessagesRegion(InternalCache cache, String ePolicy, int capacity,
- int port, String overFlowDir, boolean isDiskStore) {
- InternalRegionFactory factory =
- getRegionFactoryForClientMessagesRegion(cache, ePolicy, capacity, overFlowDir, isDiskStore);
- return createClientMessagesRegion(factory, port);
- }
-
- private static InternalRegionFactory getRegionFactoryForClientMessagesRegion(InternalCache cache,
- String ePolicy, int capacity, String overflowDir, boolean isDiskStore)
- throws InvalidValueException, GemFireIOException {
- InternalRegionFactory factory = cache.createInternalRegionFactory();
- factory.setScope(Scope.LOCAL);
-
- if (isDiskStore) {
- // overflowDir parameter is actually diskstore name
- factory.setDiskStoreName(overflowDir);
- // client subscription queue is always overflow to disk, so do async
- // see feature request #41479
- factory.setDiskSynchronous(true);
- } else if (overflowDir == null
- || overflowDir.equals(ClientSubscriptionConfig.DEFAULT_OVERFLOW_DIRECTORY)) {
- factory.setDiskStoreName(null);
- // client subscription queue is always overflow to disk, so do async
- // see feature request #41479
- factory.setDiskSynchronous(true);
- } else {
- File dir = new File(
- overflowDir + File.separatorChar + generateNameForClientMsgsRegion(OSProcess.getId()));
- // This will delete the overflow directory when virtual machine terminates.
- dir.deleteOnExit();
- if (!dir.mkdirs() && !dir.isDirectory()) {
- throw new GemFireIOException(
- "Could not create client subscription overflow directory: " + dir.getAbsolutePath());
- }
- File[] dirs = {dir};
-
- DiskStoreFactory dsf = cache.createDiskStoreFactory();
- dsf.setAutoCompact(true).setDiskDirsAndSizes(dirs, new int[] {MAX_VALUE}).create("bsi");
-
- factory.setDiskStoreName("bsi");
- // backward compatibility, it was sync
- factory.setDiskSynchronous(true);
- }
- factory.setDataPolicy(DataPolicy.NORMAL);
- // enable statistics
- factory.setStatisticsEnabled(true);
- /* setting LIFO related eviction attributes */
- if (HARegionQueue.HA_EVICTION_POLICY_ENTRY.equals(ePolicy)) {
- factory.setEvictionAttributes(
- EvictionAttributes.createLIFOEntryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
- } else if (HARegionQueue.HA_EVICTION_POLICY_MEMORY.equals(ePolicy)) {
- // condition refinement
- factory.setEvictionAttributes(
- EvictionAttributes.createLIFOMemoryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
- } else {
- // throw invalid eviction policy exception
- throw new InvalidValueException(
- String.format("%s Invalid eviction policy", ePolicy));
- }
- return factory;
- }
-
- private static String createClientMessagesRegion(InternalRegionFactory factory, int port) {
- // generating unique name in VM for ClientMessagesRegion
- String regionName = generateNameForClientMsgsRegion(port);
- try {
- factory.setDestroyLockFlag(true).setRecreateFlag(false)
- .setSnapshotInputStream(null).setImageTarget(null).setIsUsedForMetaRegion(true);
- factory.create(regionName);
- } catch (RegionExistsException ree) {
- InternalGemFireError assErr = new InternalGemFireError("unexpected exception");
- assErr.initCause(ree);
- throw assErr;
- }
- return regionName;
- }
-
- /**
- * Generates the name for the client subscription using the given id.
- *
- * @since GemFire 5.7
- */
- public static String generateNameForClientMsgsRegion(int id) {
- return ClientSubscriptionConfigImpl.CLIENT_SUBSCRIPTION + "_" + id;
- }
-
/*
* Marker class name to identify the lock more easily in thread dumps private static class
* ClientMessagesRegionLock extends Object { }
@@ -721,13 +713,6 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return getName();
}
- @MakeNotStatic
- private static final AtomicInteger profileSN = new AtomicInteger();
-
- private static int createSerialNumber() {
- return profileSN.incrementAndGet();
- }
-
/**
* Returns an array of all the groups of this cache server. This includes those from the groups
* gemfire property and those explicitly added to this server.
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/client/protocol/ClientProtocolServiceLoader.java b/geode-core/src/main/java/org/apache/geode/internal/cache/client/protocol/ClientProtocolServiceLoader.java
index 6f91872..fdaf69c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/client/protocol/ClientProtocolServiceLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/client/protocol/ClientProtocolServiceLoader.java
@@ -17,24 +17,21 @@ package org.apache.geode.internal.cache.client.protocol;
import java.util.LinkedList;
import java.util.List;
-import java.util.ServiceLoader;
import org.apache.geode.internal.cache.client.protocol.exception.ServiceLoadingFailureException;
+import org.apache.geode.services.module.ModuleService;
public class ClientProtocolServiceLoader {
private final List<ClientProtocolService> clientProtocolServices;
- public ClientProtocolServiceLoader() {
- clientProtocolServices = initializeProtocolServices();
+ public ClientProtocolServiceLoader(ModuleService moduleService) {
+ clientProtocolServices = initializeProtocolServices(moduleService);
}
- private static List<ClientProtocolService> initializeProtocolServices() {
+ private List<ClientProtocolService> initializeProtocolServices(ModuleService moduleService) {
List<ClientProtocolService> resultList = new LinkedList<>();
- for (ClientProtocolService clientProtocolService : ServiceLoader
- .load(ClientProtocolService.class)) {
- resultList.add(clientProtocolService);
- }
-
+ moduleService.loadService(ClientProtocolService.class)
+ .ifSuccessful(clientProtocolServices -> resultList.addAll(clientProtocolServices));
return resultList;
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java
index 7ee9961..df5ea2e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java
@@ -29,6 +29,7 @@ import org.apache.geode.internal.cache.client.protocol.exception.ServiceVersionN
import org.apache.geode.internal.cache.tier.Acceptor;
import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.services.module.ModuleService;
/**
* Creates instances of ServerConnection based on the connection mode provided.
@@ -38,8 +39,8 @@ public class ServerConnectionFactory {
private final ClientProtocolServiceLoader clientProtocolServiceLoader;
private volatile ClientProtocolService clientProtocolService;
- public ServerConnectionFactory() {
- clientProtocolServiceLoader = new ClientProtocolServiceLoader();
+ public ServerConnectionFactory(ModuleService moduleService) {
+ clientProtocolServiceLoader = new ClientProtocolServiceLoader(moduleService);
}
private synchronized ClientProtocolService getClientProtocolService(
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java
index fd678c8..0d362b7 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java
@@ -40,6 +40,7 @@ import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.logging.internal.LoggingSession;
import org.apache.geode.management.internal.AgentUtil;
import org.apache.geode.management.internal.BaseManagementService;
+import org.apache.geode.services.module.ModuleService;
public class InternalLocatorTest {
private InternalLocator internalLocator; // the instance under test
@@ -48,9 +49,11 @@ public class InternalLocatorTest {
private BaseManagementService managementService;
private AgentUtil agentUtil;
private HttpService httpService;
+ private InternalDistributedSystem internalDistributedSystem;
@Before
public void setup() throws URISyntaxException {
+ internalDistributedSystem = mock(InternalDistributedSystem.class);
distributionConfig = mock(DistributionConfigImpl.class);
cache = mock(InternalCacheForClientAccess.class);
managementService = mock(BaseManagementService.class);
@@ -71,11 +74,13 @@ public class InternalLocatorTest {
when(cache.getOptionalService(HttpService.class))
.thenReturn(Optional.of(httpService));
when(cache.getCacheForProcessingClientRequests()).thenReturn(cache);
+ // when(internalLocator.getInternalDistributedSystem()).thenReturn(internalDistributedSystem);
+ when(internalDistributedSystem.getModuleService()).thenReturn(ModuleService.DEFAULT);
when(agentUtil.findWarLocation("geode-web-management")).thenReturn(uri);
BaseManagementService.setManagementService(cache, managementService);
internalLocator = new InternalLocator(0, loggingSession, null, null, null, null,
- null, null, distributionConfig, null);
+ null, null, distributionConfig, null, ModuleService.DEFAULT);
}
@After
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheServerImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheServerImplTest.java
index 361e688..48ad632 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheServerImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheServerImplTest.java
@@ -46,6 +46,7 @@ import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.internal.statistics.StatisticsClockFactory;
import org.apache.geode.internal.statistics.StatisticsManager;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.junit.categories.ClientServerTest;
@Category(ClientServerTest.class)
@@ -89,6 +90,7 @@ public class CacheServerImplTest {
when(system.getConfig()).thenReturn(config);
when(system.getProperties()).thenReturn(new Properties());
when(system.getStatisticsManager()).thenReturn(statisticsManager);
+ when(cache.getInternalDistributedSystem().getModuleService()).thenReturn(ModuleService.DEFAULT);
}
@Test
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
index fd08029..48c8e9d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
@@ -61,6 +61,7 @@ import org.apache.geode.internal.cache.eviction.HeapEvictor;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.internal.JmxManagerAdvisor;
import org.apache.geode.pdx.internal.TypeRegistry;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.awaitility.GeodeAwaitility;
import org.apache.geode.test.junit.rules.ExecutorServiceRule;
@@ -69,20 +70,17 @@ import org.apache.geode.test.junit.rules.ExecutorServiceRule;
*/
public class GemFireCacheImplTest {
+ @Rule
+ public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+ @Rule
+ public ExecutorServiceRule executorServiceRule = new ExecutorServiceRule();
private CacheConfig cacheConfig;
private InternalDistributedSystem internalDistributedSystem;
private PoolFactory poolFactory;
private ReplyProcessor21Factory replyProcessor21Factory;
private TypeRegistry typeRegistry;
-
private GemFireCacheImpl gemFireCacheImpl;
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Rule
- public ExecutorServiceRule executorServiceRule = new ExecutorServiceRule();
-
@Before
public void setUp() {
cacheConfig = mock(CacheConfig.class);
@@ -103,6 +101,7 @@ public class GemFireCacheImplTest {
.thenReturn(distributionManager);
when(internalDistributedSystem.getCancelCriterion())
.thenReturn(mock(CancelCriterion.class));
+ when(internalDistributedSystem.getModuleService()).thenReturn(ModuleService.DEFAULT);
when(replyProcessor21.getProcessorId())
.thenReturn(21);
when(replyProcessor21Factory.create(any(), any()))
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java
index 1c67e01..29d8824 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java
@@ -41,6 +41,7 @@ import org.apache.geode.internal.cache.client.protocol.exception.ServiceLoadingF
import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.CommunicationMode;
import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.junit.categories.ClientServerTest;
/**
@@ -68,7 +69,8 @@ public class ServerConnectionFactoryTest {
@Test
public void newClientProtocolFailsWithoutSystemPropertySet() {
Throwable thrown = catchThrowable(
- () -> new ServerConnectionFactory().makeServerConnection(mock(Socket.class),
+ () -> new ServerConnectionFactory(ModuleService.DEFAULT).makeServerConnection(
+ mock(Socket.class),
mock(InternalCache.class), mock(CachedRegionHelper.class), mock(CacheServerStats.class),
0, 0, "", CommunicationMode.ProtobufClientServerProtocol.getModeNumber(),
mock(AcceptorImpl.class), mock(SecurityService.class)));
@@ -80,7 +82,8 @@ public class ServerConnectionFactoryTest {
public void newClientProtocolFailsWithSystemPropertySet() {
System.setProperty("geode.feature-protobuf-protocol", "true");
Throwable thrown = catchThrowable(
- () -> new ServerConnectionFactory().makeServerConnection(mock(Socket.class),
+ () -> new ServerConnectionFactory(ModuleService.DEFAULT).makeServerConnection(
+ mock(Socket.class),
mock(InternalCache.class), mock(CachedRegionHelper.class), mock(CacheServerStats.class),
0, 0, "", CommunicationMode.ProtobufClientServerProtocol.getModeNumber(),
mock(AcceptorImpl.class), mock(SecurityService.class)));
@@ -99,7 +102,8 @@ public class ServerConnectionFactoryTest {
when(socket.getInputStream()).thenReturn(mock(InputStream.class));
ServerConnection serverConnection =
- new ServerConnectionFactory().makeServerConnection(socket, mock(InternalCache.class),
+ new ServerConnectionFactory(ModuleService.DEFAULT).makeServerConnection(socket,
+ mock(InternalCache.class),
mock(CachedRegionHelper.class), mock(CacheServerStats.class), 0, 0, "",
communicationMode.getModeNumber(),
mock(AcceptorImpl.class), mock(SecurityService.class));
@@ -120,7 +124,8 @@ public class ServerConnectionFactoryTest {
when(socket.getInputStream()).thenReturn(mock(InputStream.class));
ServerConnection serverConnection =
- new ServerConnectionFactory().makeServerConnection(socket, mock(InternalCache.class),
+ new ServerConnectionFactory(ModuleService.DEFAULT).makeServerConnection(socket,
+ mock(InternalCache.class),
mock(CachedRegionHelper.class), mock(CacheServerStats.class), 0, 0, "",
communicationMode.getModeNumber(),
mock(AcceptorImpl.class), mock(SecurityService.class));
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
index a2669fe..9f8d075 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
@@ -44,6 +44,7 @@ import org.apache.geode.internal.cache.tier.ServerSideHandshake;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.security.AuthenticationRequiredException;
+import org.apache.geode.services.module.ModuleService;
import org.apache.geode.test.junit.categories.ClientServerTest;
@Category(ClientServerTest.class)
@@ -71,7 +72,8 @@ public class ServerConnectionTest {
when(socket.getInetAddress()).thenReturn(inetAddress);
serverConnection =
- new ServerConnectionFactory().makeServerConnection(socket, mock(InternalCache.class),
+ new ServerConnectionFactory(ModuleService.DEFAULT).makeServerConnection(socket,
+ mock(InternalCache.class),
mock(CachedRegionHelper.class), mock(CacheServerStats.class), 0, 0, null,
CommunicationMode.PrimaryServerToClient.getModeNumber(), acceptor,
mock(SecurityService.class));
diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java
index e8569cd..948b0e5 100644
--- a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java
+++ b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java
@@ -53,8 +53,8 @@ import org.apache.geode.internal.inet.LocalHostUtil;
import org.apache.geode.internal.serialization.DSFIDSerializer;
import org.apache.geode.internal.serialization.internal.DSFIDSerializerImpl;
import org.apache.geode.logging.internal.executors.LoggingExecutors;
-import org.apache.geode.test.junit.rules.ExecutorServiceRule;
import org.apache.geode.services.module.ModuleService;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
/**
* Tests of using the membership APIs to make multiple Membership systems that communicate