void (int writesToWakeUp, long napTimeNs) { try { var sleepStart = System.nanoTime(); int iterations = 1; while (writesToWakeUp < INDEX_WRITES_QUEUED.get()) { LockSupport.parkNanos(napTimeNs * iterations); iterations++; } var slept = (System.nanoTime() - sleepStart) / 1_000_000; LOG.debug("Waking indexer ", SLEEPING_INDEXERS.get(), " of ", myNumberOfIndexingThreads, " by ", INDEX_WRITES_QUEUED.get(), " updates in queue, should have wake up on ", writesToWakeUp, "; slept for ", slept, " ms, ", iterations, " iterations; "); } finally { SLEEPING_INDEXERS.decrementAndGet(); } }