This is an automated email from the ASF dual-hosted git repository.
udo 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 5cac05e GEODE-3717: Fixing CacheMaxConnectionJUnitTest
5cac05e is described below
commit 5cac05e774738a24da8a859ece0f744594fdeed6
Author: kohlmu-pivotal <[email protected]>
AuthorDate: Thu Sep 28 11:05:52 2017 -0700
GEODE-3717: Fixing CacheMaxConnectionJUnitTest
---
.../internal/cache/tier/sockets/ServerConnectionFactory.java | 12 ++++++++----
.../protocol/acceptance/CacheMaxConnectionJUnitTest.java | 6 +++++-
2 files changed, 13 insertions(+), 5 deletions(-)
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 ed8f259..8f3a8c3 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
@@ -44,11 +44,14 @@ public class ServerConnectionFactory {
if (authenticators != null) {
return;
}
- authenticators = new HashMap<>();
+ HashMap tmp = new HashMap<>();
+
ServiceLoader<Authenticator> loader =
ServiceLoader.load(Authenticator.class);
for (Authenticator streamAuthenticator : loader) {
- authenticators.put(streamAuthenticator.implementationID(),
streamAuthenticator.getClass());
+ tmp.put(streamAuthenticator.implementationID(),
streamAuthenticator.getClass());
}
+
+ authenticators = tmp;
}
private synchronized ClientProtocolMessageHandler initializeMessageHandler(
@@ -57,9 +60,10 @@ public class ServerConnectionFactory {
return protocolHandler;
}
- protocolHandler = new MessageHandlerFactory().makeMessageHandler();
- protocolHandler.initializeStatistics(statisticsName, statisticsFactory);
+ ClientProtocolMessageHandler tempHandler = new
MessageHandlerFactory().makeMessageHandler();
+ tempHandler.initializeStatistics(statisticsName, statisticsFactory);
+ protocolHandler = tempHandler;
return protocolHandler;
}
diff --git
a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
index f767bbd..d1789ad 100644
---
a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
+++
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
@@ -90,6 +90,7 @@ public class CacheMaxConnectionJUnitTest {
cacheFactory.set(ConfigurationProperties.MCAST_PORT, "0");
cacheFactory.set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION,
"false");
cacheFactory.set(ConfigurationProperties.USE_CLUSTER_CONFIGURATION,
"false");
+ cacheFactory.set(ConfigurationProperties.TCP_PORT, "0");
cache = cacheFactory.create();
CacheServer cacheServer = cache.addCacheServer();
@@ -118,6 +119,7 @@ public class CacheMaxConnectionJUnitTest {
SocketCreatorFactory.close();
}
+ // 0 threads implies not selector.
@Test
public void testNewProtocolRespectsMaxConnectionLimit_notSelector() throws
Exception {
testNewProtocolRespectsMaxConnectionLimit(0, false);
@@ -128,6 +130,8 @@ public class CacheMaxConnectionJUnitTest {
testNewProtocolRespectsMaxConnectionLimit(4, true);
}
+ // Set the maximum connection limit, connect that many clients, check they
all connected, check we
+ // can't create another, and repeat once to be sure we're cleaning up.
private void testNewProtocolRespectsMaxConnectionLimit(int threads, boolean
isSelector)
throws Exception {
final int connections = 16;
@@ -173,7 +177,7 @@ public class CacheMaxConnectionJUnitTest {
throws Exception {
final Socket[] sockets = new Socket[connections];
- ExecutorService executor = Executors.newFixedThreadPool(20);
+ ExecutorService executor = Executors.newFixedThreadPool(connections);
// Used to assert the exception is non-null.
ArrayList<Callable<Exception>> callables = new ArrayList<>();
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].