Description
In CacheReplicationMonitor, following code is try to check whether needs to rescan every interval ms, if rescan takes n ms, then subtract n ms for the interval. But if the delta <=0, it breaks and start rescan, there will be potential issue: if user set the interval to a small value or rescan finished after a while exceeding the interval, then rescan will happen in loop. Furthermore, delta <= 0 trigger the rescan should not be the intention, since if needs rescan, needsRescan will be set.
while (true) { if (shutdown) { LOG.info("Shutting down CacheReplicationMonitor"); return; } if (needsRescan) { LOG.info("Rescanning because of pending operations"); break; } long delta = (startTimeMs + intervalMs) - curTimeMs; if (delta <= 0) { LOG.info("Rescanning after " + (curTimeMs - startTimeMs) + " milliseconds"); break; } doRescan.await(delta, TimeUnit.MILLISECONDS); curTimeMs = Time.monotonicNow(); }