/** Stops FileCleaner. */ public static void stop() { exec.shutdownNow(); try { exec.awaitTermination(3, TimeUnit.SECONDS); } catch (InterruptedException ignored) { } clean(); files.clear(); LOG.info("File cleaner is stopped"); }
@PreDestroy void stop() { FileCleaner.stop(); } }
private String downloadContent(URL url) throws InfrastructureException { File file = null; try { file = IoUtil.downloadFileWithRedirect(null, "recipe", null, url); return IoUtil.readAndCloseQuietly(new FileInputStream(file)); } catch (IOException e) { LOG.debug(e.getLocalizedMessage(), e); throw new InfrastructureException("Failed to download recipe content"); } finally { if (file != null && !file.delete()) { FileCleaner.addFile(file); } } }