pivotal-jbarrett commented on code in PR #7517: URL: https://github.com/apache/geode/pull/7517#discussion_r859051195
########## geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java: ########## @@ -41,26 +43,49 @@ public class LiveServerPinger extends EndpointListenerAdapter { protected final InternalPool pool; protected final long pingIntervalNanos; + /** + * Initial delay offset time between LiveServerPinger tasks. Time in milliseconds. + */ + public static final int INITIAL_DELAY_MULTIPLYER_IN_MILLISECONDS = + Integer.getInteger(GeodeGlossary.GEMFIRE_PREFIX + + "LiveServerPinger.INITIAL_DELAY_MULTIPLYER_IN_MILLISECONDS", 0); + + private final AtomicInteger offsetIndex = new AtomicInteger(0); + + public LiveServerPinger(InternalPool pool) { this.pool = pool; - pingIntervalNanos = ((pool.getPingInterval() + 1) / 2) * NANOS_PER_MS; + pingIntervalNanos = TimeUnit.MILLISECONDS.toNanos((pool.getPingInterval() + 1) / 2); } @Override public void endpointCrashed(Endpoint endpoint) { + offsetIndex.set(0); // Reset counter Review Comment: If this statement really needs this comment then I suggest making it a method. I also suggest changing the member name a little. ```java private void resetInitialDelay() { intitialDelay.set(0); } ``` ########## geode-assembly/src/acceptanceTest/java/org/apache/geode/cache/wan/SeveralGatewayReceiversWithSamePortAndHostnameForSendersTest.java: ########## @@ -214,6 +215,60 @@ public void testTwoSendersWithSameIdShouldUseSameValueForEnforceThreadsConnectTo } + + /** + * The aim of this test is verify that when several gateway receivers in a remote site share the + * same port and hostname-for-senders, the pings sent from the gateway senders reach the right + * gateway receiver and not just any of the receivers. Check that only one additional connection + * is used. + */ + @Test + public void testPingsToReceiversWithSamePortAndHostnameForSendersUseOnlyOneMoreConnection() + throws InterruptedException { + String senderId = "ln"; + String regionName = "region-wan"; + final int remoteLocPort = docker.getExternalPortForService("haproxy", 20334); + + int locPort = createLocator(VM.getVM(0), 1, remoteLocPort); + + VM vm1 = VM.getVM(1); + + vm1.invoke(() -> { + System.setProperty( + GeodeGlossary.GEMFIRE_PREFIX + "InitialServerPinger.OFFSET", "500"); Review Comment: Does not match the changes: ``` LiveServerPinger.INITIAL_DELAY_MULTIPLYER_IN_MILLISECONDS ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org