Sho SHIMIZU
Committed by Jonathan Hart

Refactor: Use Duration instead of primitive value

Change-Id: Id7de939fd8f1c74cf669207edf16378019b2acc3
...@@ -22,6 +22,7 @@ import static org.slf4j.LoggerFactory.getLogger; ...@@ -22,6 +22,7 @@ import static org.slf4j.LoggerFactory.getLogger;
22 import static java.util.concurrent.Executors.newCachedThreadPool; 22 import static java.util.concurrent.Executors.newCachedThreadPool;
23 23
24 import java.io.IOException; 24 import java.io.IOException;
25 +import java.time.Duration;
25 import java.util.concurrent.CompletableFuture; 26 import java.util.concurrent.CompletableFuture;
26 import java.util.concurrent.ExecutionException; 27 import java.util.concurrent.ExecutionException;
27 import java.util.concurrent.ExecutorService; 28 import java.util.concurrent.ExecutorService;
...@@ -54,7 +55,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient { ...@@ -54,7 +55,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient {
54 55
55 private final Logger log = getLogger(getClass()); 56 private final Logger log = getLogger(getClass());
56 57
57 - public static final long RETRY_INTERVAL_MILLIS = 2000; 58 + public static final Duration RETRY_INTERVAL = Duration.ofMillis(2000);
58 59
59 private final ClusterService clusterService; 60 private final ClusterService clusterService;
60 private final ClusterCommunicationService clusterCommunicator; 61 private final ClusterCommunicationService clusterCommunicator;
...@@ -179,7 +180,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient { ...@@ -179,7 +180,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient {
179 } 180 }
180 byte[] response = clusterCommunicator 181 byte[] response = clusterCommunicator
181 .sendAndReceive(message, remoteNode.id()) 182 .sendAndReceive(message, remoteNode.id())
182 - .get(RETRY_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); 183 + .get(RETRY_INTERVAL.toMillis(), TimeUnit.MILLISECONDS);
183 if (!connectionOK.getAndSet(true)) { 184 if (!connectionOK.getAndSet(true)) {
184 log.info("Connectivity to {} restored", remoteNode); 185 log.info("Connectivity to {} restored", remoteNode);
185 } 186 }
......