@Override public void close() throws IOException { cancelCleanupTask(); if (shutdownRequested.compareAndSet(false, true)) { log.info("Shutting down BLOB cache"); // Clean up the storage directory try { FileUtils.deleteDirectory(storageDir); } finally { // Remove shutdown hook to prevent resource leaks ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), log); } } }
@Override protected File getFileInternal(@Nullable JobID jobId, BlobKey blobKey) throws IOException { File file = super.getFileInternal(jobId, blobKey); readWriteLock.readLock().lock(); try { // regarding concurrent operations, it is not really important which timestamp makes // it into the map as they are close to each other anyway, also we can simply // overwrite old values as long as we are in the read (or write) lock blobExpiryTimes.put(Tuple2.of(jobId, (TransientBlobKey) blobKey), System.currentTimeMillis() + cleanupInterval); } finally { readWriteLock.readLock().unlock(); } return file; }
File incomingFile = createTemporaryFilename(); try { try {
File incomingFile = createTemporaryFilename(); try { try {
@Override public void close() throws IOException { cancelCleanupTask(); if (shutdownRequested.compareAndSet(false, true)) { log.info("Shutting down BLOB cache"); // Clean up the storage directory try { FileUtils.deleteDirectory(storageDir); } finally { // Remove shutdown hook to prevent resource leaks ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), log); } } }
@Override protected File getFileInternal(@Nullable JobID jobId, BlobKey blobKey) throws IOException { File file = super.getFileInternal(jobId, blobKey); readWriteLock.readLock().lock(); try { // regarding concurrent operations, it is not really important which timestamp makes // it into the map as they are close to each other anyway, also we can simply // overwrite old values as long as we are in the read (or write) lock blobExpiryTimes.put(Tuple2.of(jobId, (TransientBlobKey) blobKey), System.currentTimeMillis() + cleanupInterval); } finally { readWriteLock.readLock().unlock(); } return file; }
File incomingFile = createTemporaryFilename(); try { try {
@Override public void close() throws IOException { cancelCleanupTask(); if (shutdownRequested.compareAndSet(false, true)) { log.info("Shutting down BLOB cache"); // Clean up the storage directory try { FileUtils.deleteDirectory(storageDir); } finally { // Remove shutdown hook to prevent resource leaks ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), log); } } }
@Override protected File getFileInternal(@Nullable JobID jobId, BlobKey blobKey) throws IOException { File file = super.getFileInternal(jobId, blobKey); readWriteLock.readLock().lock(); try { // regarding concurrent operations, it is not really important which timestamp makes // it into the map as they are close to each other anyway, also we can simply // overwrite old values as long as we are in the read (or write) lock blobExpiryTimes.put(Tuple2.of(jobId, (TransientBlobKey) blobKey), System.currentTimeMillis() + cleanupInterval); } finally { readWriteLock.readLock().unlock(); } return file; }