void () { myFileWatcherExecutor.shutdown(); Future<?> lastTask = myLastTask.get(); if (lastTask != null) { lastTask.cancel(false); } try { myFileWatcherExecutor.awaitTermination(1, TimeUnit.HOURS); } catch (InterruptedException e) { LOG.error(e); } PluggableFileWatcher.EP_NAME.forEachExtensionSafe(watcher -> watcher.dispose()); }