void (int finishedFile) { boolean exit = ourLock.withReadLock(finishedFile, () -> { Timestamps timestamps = ourTimestampsCache.get(finishedFile); if (timestamps == null) return true; if (!timestamps.isDirty()) { ourTimestampsCache.remove(finishedFile); return true; } return false; }); if (exit) return; while (!ourFinishedFiles.offer(finishedFile)) { doFlush(); } }