DomGarguilo commented on code in PR #6041:
URL: https://github.com/apache/accumulo/pull/6041#discussion_r2673160417


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java:
##########
@@ -84,18 +86,21 @@ private ThriftTransportPool(LongSupplier maxAgeMillis, 
boolean shouldHalt) {
   private Runnable thriftConnectionPoolChecker() {
     return () -> {
       try {
-        final long minNanos = MILLISECONDS.toNanos(250);
-        final long maxNanos = MINUTES.toNanos(1);
-        long lastRun = System.nanoTime();
+        final Duration minInterval = Duration.ofMillis(250);
+        final Duration maxInterval = Duration.ofMinutes(1);
+        Timer lastRunTimer = Timer.startNew();
         // loop often, to detect shutdowns quickly
         while (!connectionPool.awaitShutdown(250)) {
           // don't close on every loop; instead, check based on configured max 
age, within bounds
-          var threshold = Math.min(maxNanos,
-              Math.max(minNanos, 
MILLISECONDS.toNanos(maxAgeMillis.getAsLong()) / 2));
-          long currentNanos = System.nanoTime();
-          if ((currentNanos - lastRun) >= threshold) {
+          Duration threshold = 
Duration.ofMillis(maxAgeMillis.getAsLong()).dividedBy(2);

Review Comment:
   Added in 85cdfb6



-- 
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