pivotal-jbarrett commented on code in PR #7517:
URL: https://github.com/apache/geode/pull/7517#discussion_r859826301


##########
geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java:
##########
@@ -41,26 +43,46 @@ 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_MULTIPLIER_IN_MILLISECONDS =
+      Integer.getInteger(GeodeGlossary.GEMFIRE_PREFIX
+          + "LiveServerPinger.INITIAL_DELAY_MULTIPLIER_IN_MILLISECONDS", 0);
+
+  private final AtomicInteger initialDelayIndex = 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) {
+    resetInitialDelay();
     cancelFuture(endpoint);
   }
 
   @Override
   public void endpointNoLongerInUse(Endpoint endpoint) {
+    resetInitialDelay();
     cancelFuture(endpoint);
   }
 
   @Override
   public void endpointNowInUse(Endpoint endpoint) {
     try {
+      // At each registration of new endpoint increase counter for calculation 
of initial delay

Review Comment:
   I think this comment makes more sense as a javadoc on the method.



##########
geode-assembly/src/acceptanceTest/java/org/apache/geode/cache/wan/SeveralGatewayReceiversWithSamePortAndHostnameForSendersTest.java:
##########
@@ -357,6 +406,16 @@ private static int getSenderPoolDisconnects(VM vm, String 
senderId) {
     });
   }
 
+  private static int getSenderPoolConnects(VM vm, String senderId) {
+    return vm.invoke(() -> {
+      AbstractGatewaySender sender =
+          (AbstractGatewaySender) 
CacheFactory.getAnyInstance().getGatewaySender(senderId);
+      assertNotNull(sender);

Review Comment:
   Use AssertJ for new test code. 
   Would prefer updating whole test to AssertJ.



##########
geode-core/src/test/java/org/apache/geode/cache/client/internal/LiveServerPingerTest.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.client.internal;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import org.apache.geode.test.junit.categories.ClientServerTest;
+import org.apache.geode.util.internal.GeodeGlossary;
+
+@Category({ClientServerTest.class})

Review Comment:
   This is unused by JUnit 5 and can just be removed entirely.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to