You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2020/03/16 21:26:53 UTC
[geode] branch feature/GEODE-7877 created (now 41e37df)
This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a change to branch feature/GEODE-7877
in repository https://gitbox.apache.org/repos/asf/geode.git.
at 41e37df GEODE-7877: deal with the static Version map in TcpClient
This branch includes the following new commits:
new 41e37df GEODE-7877: deal with the static Version map in TcpClient
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[geode] 01/01: GEODE-7877: deal with the static Version map in
TcpClient
Posted by bs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a commit to branch feature/GEODE-7877
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 41e37df79f05cdbd6d45967b2594014af85015dd
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Mon Mar 16 14:22:25 2020 -0700
GEODE-7877: deal with the static Version map in TcpClient
The server-version map that tracks Locator versions is now an instance
variable instead of a static.
I looked into removing the map altogether but it's really needed for
rolling-upgrade purposes. When one locator is rolled to a new version
of Geode but another locator is still running the old version it's
essential that the new locator know that it's communicating with an old
locator.
---
.../apache/geode/test/dunit/rules/DistributedRule.java | 2 --
.../geode/distributed/internal/tcpserver/TcpClient.java | 16 +---------------
.../internal/tcpserver/TcpServerJUnitTest.java | 6 ------
3 files changed, 1 insertion(+), 23 deletions(-)
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedRule.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedRule.java
index 7799697..1943fcd 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedRule.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedRule.java
@@ -28,7 +28,6 @@ import org.apache.geode.cache30.ClientServerTestCase;
import org.apache.geode.cache30.RegionTestCase;
import org.apache.geode.distributed.internal.DistributionMessageObserver;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.tcpserver.TcpClient;
import org.apache.geode.internal.admin.ClientStatsManager;
import org.apache.geode.internal.cache.DiskStoreObserver;
import org.apache.geode.internal.cache.InitialImageOperation;
@@ -243,7 +242,6 @@ public class DistributedRule extends AbstractDistributedRule {
RegionTestCase.preSnapshotRegion = null;
SocketCreator.resetHostNameCache();
SocketCreator.resolve_dns = true;
- TcpClient.clearStaticData();
// clear system properties -- keep alphabetized
System.clearProperty(GeodeGlossary.GEMFIRE_PREFIX + "log-level");
diff --git a/geode-tcp-server/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java b/geode-tcp-server/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
index f57b584..fd71941 100644
--- a/geode-tcp-server/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
+++ b/geode-tcp-server/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
@@ -32,7 +32,6 @@ import javax.net.ssl.SSLException;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.annotations.internal.MakeNotStatic;
import org.apache.geode.internal.serialization.ObjectDeserializer;
import org.apache.geode.internal.serialization.ObjectSerializer;
import org.apache.geode.internal.serialization.UnsupportedSerializationVersionException;
@@ -54,8 +53,7 @@ public class TcpClient {
private static final int DEFAULT_REQUEST_TIMEOUT = 60 * 2 * 1000;
- @MakeNotStatic
- private static final Map<HostAndPort, Short> serverVersions =
+ private final Map<HostAndPort, Short> serverVersions =
new HashMap<>();
private final TcpSocketCreator socketCreator;
@@ -309,16 +307,4 @@ public class TcpClient {
}
return Short.valueOf(Version.GFE_57.ordinal());
}
-
-
- /**
- * Clear static class information concerning Locators. This is used in unit tests. It will force
- * TcpClient to send version-request messages to locators to reestablish knowledge of their
- * communication protocols.
- */
- public static void clearStaticData() {
- synchronized (serverVersions) {
- serverVersions.clear();
- }
- }
}
diff --git a/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java b/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java
index 6e43f47..c79d5c8 100644
--- a/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java
+++ b/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java
@@ -37,7 +37,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.invocation.InvocationOnMock;
@@ -81,11 +80,6 @@ public class TcpServerJUnitTest {
assertThat(server.isAlive()).isTrue();
}
- @Before
- public void setup() {
- TcpClient.clearStaticData();
- }
-
@Test
public void testConnectToUnknownHost() throws Exception {
final TcpClient tcpClient = createTcpClient();