void (@Nullable ScheduledFuture<?> expectedInvalidationRequest) { myLock.lock(); try { if (myFile == null) return; if (expectedInvalidationRequest != null) { if (doTracing) LOG.trace("Invalidation cache size exceeded"); if (myInvalidationRequest != expectedInvalidationRequest) { return; } } myInvalidationRequest = null; long t = doTracing ? System.nanoTime() : 0; try { myFile.close(); } catch (IOException ex) { LOG.info(ex); } if (doTracing) { t = System.nanoTime() - t; LOG.trace("Closed: " + getFile() + " in " + TimeUnit.NANOSECONDS.toMillis(t) + "ms" + ", times closed: " + ourCloseCount.incrementAndGet() + ", close time: " + TimeUnit.NANOSECONDS.toMillis(ourCloseTime.addAndGet(t)) + "ms"); } myFile = null; } finally { myLock.unlock(); } }