StorageOwner (Consumer<Future<?>> asyncTaskCollector) { return new CompositeStorageOwner() { @Override public void clean() throws IOException { try { close(); } finally { asyncTaskCollector.accept(FileUtil.asyncDelete(myDataPaths.getTargetsDataRoot())); } } @Override protected Iterable<BuildTargetStorages> getChildStorages() { return () -> myTargetStorages.values().iterator(); } }; }