@@ -52,6 +52,7 @@ public class ParallelCommonsCompressArchiveCreator implements ArchiveCreator {
52
52
private final ParallelScatterZipCreator scatterZipCreator ;
53
53
private final ScatterZipOutputStream directories ;
54
54
private final int compressionMethod ;
55
+ private final Path tempDirectory ;
55
56
56
57
private final Map <String , String > addedFiles = new HashMap <>();
57
58
@@ -69,11 +70,12 @@ public class ParallelCommonsCompressArchiveCreator implements ArchiveCreator {
69
70
this .archivePath = archivePath ;
70
71
this .archive = new ZipArchiveOutputStream (archivePath );
71
72
this .archive .setMethod (compressionMethod );
73
+ this .tempDirectory = Files .createTempDirectory (outputTarget , "zip-builder-files" );
72
74
73
75
scatterZipCreator = new ParallelScatterZipCreator (
74
76
// we need to make sure our own executor won't be shut down by Commons Compress...
75
77
new DoNotShutdownDelegatingExecutorService (executorService ),
76
- new DefaultBackingStoreSupplier (Files . createTempDirectory ( outputTarget , "zip-builder-files" ) ),
78
+ new DefaultBackingStoreSupplier (this . tempDirectory ),
77
79
compressionLevel );
78
80
directories = ScatterZipOutputStream .pathBased (Files .createTempFile (outputTarget , "zip-builder-dirs" , "" ),
79
81
compressionLevel );
@@ -224,6 +226,11 @@ public void close() {
224
226
} catch (IOException | InterruptedException | ExecutionException e ) {
225
227
throw new IllegalStateException ("Unable to create archive: " + archivePath , e );
226
228
}
229
+ try {
230
+ Files .deleteIfExists (tempDirectory );
231
+ } catch (Exception e ) {
232
+ // noop, it's not a big deal to keep this directory around
233
+ }
227
234
}
228
235
229
236
private static class DoNotShutdownDelegatingExecutorService implements ExecutorService {
0 commit comments