keith-turner commented on code in PR #4078:
URL: https://github.com/apache/accumulo/pull/4078#discussion_r1427238919


##########
server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java:
##########
@@ -73,6 +78,37 @@ protected AbstractServer(String appName, ConfigOpts opts, 
String[] args) {
         lmd.getIntervalMillis(context.getConfiguration()), 
TimeUnit.MILLISECONDS);
     ThreadPools.watchNonCriticalScheduledTask(future);
     processMetrics = new ProcessMetrics(context);
+    idleStopEnabled = getIdleStopEnabled(context.getConfiguration());
+    idleStopPeriod = getIdleStopPeriod(context.getConfiguration());
+  }
+
+  protected boolean getIdleStopEnabled(AccumuloConfiguration conf) {
+    return false;
+  }
+
+  protected long getIdleStopPeriod(AccumuloConfiguration conf) {
+    return 0L;
+  }
+
+  public boolean shouldStopDueToIdleCondition(Supplier<Boolean> idleCondition) 
{
+    if (!idleStopEnabled) {
+      return false;
+    }
+    boolean idle = idleCondition.get();
+    if (!idle) {
+      idlePeriodStart = 0;
+      return false;
+    } else if (idlePeriodStart == 0) {
+      idlePeriodStart = System.currentTimeMillis();

Review Comment:
   Could use nanoTime to make the code resilient to changes in wall clock time 
on the host.



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