dlmarion commented on code in PR #6433:
URL: https://github.com/apache/accumulo/pull/6433#discussion_r3437542266
##########
server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java:
##########
@@ -792,26 +792,53 @@ private void fetchTabletInformation(SystemInformation
summary, UpdateTasks futur
public void run() {
long lastRunTime = 0;
+ final Timer noConnectionTimer = Timer.startNew();
+ final int clearStateMins = 10;
+ final Duration clearStateDuration = Duration.ofMinutes(clearStateMins);
+ final long minimumRefreshTimeMs = 5000;
while (true) {
+ // Only refresh internal data structure every 5s (old monitor logic).
+ while (NanoTime.millisElapsed(lastRunTime, NanoTime.now()) <
minimumRefreshTimeMs) {
+ LOG.trace("Waiting for the 5s refresh interval");
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new IllegalStateException(
+ "Thread " + Thread.currentThread().getName() + " interrupted",
e);
+ }
+ }
+
// Don't fetch new data if there are no connections.
- // On an initial connection, no data may be displayed.
- // If a connection has not been made in a while, stale data may be
displayed.
- // Only refresh every 5s (old monitor logic).
- while (!newConnectionEvent.get() && connectionCount.get() == 0
- && NanoTime.millisElapsed(lastRunTime, NanoTime.now()) > 5000) {
+ // When summaryRef is not set, then the REST endpoint will wait
+ // until data is retrieved. summaryRef is not set on initial
+ // connection or when there has been no connection for 5 minutes
Review Comment:
Applied in 3b819b5
--
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]