void () { assert myLock.isLocked(); ScheduledFuture<?> invalidationRequest; try { myInvalidationRequest = invalidationRequest = ourScheduledExecutorService.schedule(() -> { invalidateZipReference(); }, myInvalidationTime, TimeUnit.MILLISECONDS); } finally { myLock.unlock(); } synchronized (openFileLimitGuard) { if (openFileLimitGuard.putAndMoveToFirst(TimedZipHandler.this, invalidationRequest) == null && openFileLimitGuard.size() > MAX_SIZE) { TimedZipHandler lastKey = openFileLimitGuard.lastKey(); ScheduledFuture<?> future = openFileLimitGuard.removeLast(); lastKey.myHandle.invalidateZipReference(future); } } }