ScatterZipOutputStream instances.
Note that until 1.18, this class generally made no guarantees about the order of things written to the output file. Things that needed to come in a specific
order (manifests, directories) had to be handled by the client of this class, usually by writing these things to the ZipArchiveOutputStream
before calling writeTo on this class.
The client can supply an java., but for reasons of memory model consistency, this will be shut down by this class
prior to completion.
| Modifier and Type | Field and Description |
|---|---|
| private final ScatterGatherBackingStoreSupplier | |
| private long | |
| private final int | |
| private final ExecutorService | |
| private final Deque | |
| private long | |
| private final long | |
| private final Deque | |
| private final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| public | ParallelScatterZipCreator()
Constructs a ParallelScatterZipCreator with default threads, which is set to the number of available processors, as defined by
|
| public | ParallelScatterZipCreator(final ExecutorService
The executorService to use for parallel scheduling. For technical reasons, this will be shut down by this class. executorService)Constructs a ParallelScatterZipCreator |
| public | ParallelScatterZipCreator(final ExecutorService
The executorService to use. For technical reasons, this will be shut down by this class. executorService, final ScatterGatherBackingStoreSupplier The supplier of backing store which shall be used backingStoreSupplier)Constructs a ParallelScatterZipCreator |
| public | ParallelScatterZipCreator(final ExecutorService
The executorService to use. For technical reasons, this will be shut down by this class. executorService, final ScatterGatherBackingStoreSupplier The supplier of backing store which shall be used backingStoreSupplier, final int The compression level used in compression, this value should be -1(default level) or between 0~9. compressionLevel)Constructs a ParallelScatterZipCreator |
| Modifier and Type | Method and Description |
|---|---|
| public void | addArchiveEntry(final ZipArchiveEntry
The entry to add. zipArchiveEntry, final InputStreamSupplier The source input stream supplier source)Adds an archive entry to this archive. |
| public void | addArchiveEntry(final ZipArchiveEntryRequestSupplier
Should supply the entry to be added. zipArchiveEntryRequestSupplier)Adds an archive entry to this archive. |
| private void | |
| public final Callable | Returns: A callable that should subsequently be passed to #submitStreamAwareCallable, possibly in a wrapped/adapted from. The value of this callable is not used, but any exceptions happening inside the compression will be propagated through the callable.The entry to add. zipArchiveEntry, final InputStreamSupplier The source input stream supplier source)Creates a callable that will compress the given archive entry. |
| public final Callable | Returns: A callable that should subsequently be passed to #submitStreamAwareCallable, possibly in a wrapped/adapted from. The value of this callable is not used, but any exceptions happening inside the compression will be propagated through the callable.Should supply the entry to be added. zipArchiveEntryRequestSupplier)Creates a callable that will compress archive entry supplied by |
| private ScatterZipOutputStream | |
| public ScatterStatistics | Returns: A stringGets a message describing the overall statistics of the compression run |
| public final void | submit(final Callable<? extends Object>
The callable to run, created by callable)createCallable, possibly wrapped by caller.Submits a callable for compression. |
| public final void | submitStreamAwareCallable(final Callable<? extends ScatterZipOutputStream>
The callable to run, created by callable)createCallable, possibly wrapped by caller.Submits a callable for compression. |
| public void | writeTo(final ZipArchiveOutputStream
The targetStream)ZipArchiveOutputStream to receive the contents of the scatter streamsWrites the contents this to the target |
| backingStoreSupplier | back to summary |
|---|---|
| private final ScatterGatherBackingStoreSupplier backingStoreSupplier | |
| compressionDoneAt | back to summary |
|---|---|
| private long compressionDoneAt | |
| compressionLevel | back to summary |
|---|---|
| private final int compressionLevel | |
| executorService | back to summary |
|---|---|
| private final ExecutorService executorService | |
| futures | back to summary |
|---|---|
| private final Deque<Future<? extends ScatterZipOutputStream>> futures | |
| scatterDoneAt | back to summary |
|---|---|
| private long scatterDoneAt | |
| startedAt | back to summary |
|---|---|
| private final long startedAt | |
| streams | back to summary |
|---|---|
| private final Deque<ScatterZipOutputStream> streams | |
| tlScatterStreams | back to summary |
|---|---|
| private final ThreadLocal<ScatterZipOutputStream> tlScatterStreams | |
| ParallelScatterZipCreator | back to summary |
|---|---|
| public ParallelScatterZipCreator() Constructs a ParallelScatterZipCreator with default threads, which is set to the number of available processors, as defined by
| |
| ParallelScatterZipCreator | back to summary |
|---|---|
| public ParallelScatterZipCreator(final ExecutorService executorService) Constructs a ParallelScatterZipCreator
| |
| ParallelScatterZipCreator | back to summary |
|---|---|
| public ParallelScatterZipCreator(final ExecutorService executorService, final ScatterGatherBackingStoreSupplier backingStoreSupplier) Constructs a ParallelScatterZipCreator
| |
| ParallelScatterZipCreator | back to summary |
|---|---|
| public ParallelScatterZipCreator(final ExecutorService executorService, final ScatterGatherBackingStoreSupplier backingStoreSupplier, final int compressionLevel) throws IllegalArgumentException Constructs a ParallelScatterZipCreator
| |
| addArchiveEntry | back to summary |
|---|---|
| public void addArchiveEntry(final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier source) Adds an archive entry to this archive. This method is expected to be called from a single client thread
| |
| addArchiveEntry | back to summary |
|---|---|
| public void addArchiveEntry(final ZipArchiveEntryRequestSupplier zipArchiveEntryRequestSupplier) Adds an archive entry to this archive. This method is expected to be called from a single client thread
| |
| closeAll | back to summary |
|---|---|
| private void closeAll() | |
| createCallable | back to summary |
|---|---|
| public final Callable Creates a callable that will compress the given archive entry. This method is expected to be called from a single client thread. Consider usingaddArchiveEntry, which wraps this method and submitStreamAwareCallable. The
most common use case for using createCallable and submitStreamAwareCallable from a client is
if you want to wrap the callable in something that can be prioritized by the supplied ExecutorService, for instance to process large or slow
files first. Since the creation of the ExecutorService is handled by the client, all of this is up to the client.
| |
| createCallable | back to summary |
|---|---|
| public final Callable Creates a callable that will compress archive entry supplied by This method is expected to be called from a single client thread. The same ascreateCallable(ZipArchiveEntry, InputStreamSupplier), but the archive entry to be added is supplied by a
ZipArchiveEntryRequestSupplier.
| |
| createDeferred | back to summary |
|---|---|
private ScatterZipOutputStream createDeferred(final ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier) throws IOException
| |
| getStatisticsMessage | back to summary |
|---|---|
| public ScatterStatistics getStatisticsMessage() Gets a message describing the overall statistics of the compression run
| |
| submit | back to summary |
|---|---|
| public final void submit(final Callable<? extends Object> callable) Submits a callable for compression.
| |
| submitStreamAwareCallable | back to summary |
|---|---|
| public final void submitStreamAwareCallable(final Callable<? extends ScatterZipOutputStream> callable) Submits a callable for compression.
| |
| writeTo | back to summary |
|---|---|
| public void writeTo(final ZipArchiveOutputStream targetStream) throws IOException, InterruptedException, ExecutionException Writes the contents this to the target It may be beneficial to write things like directories and manifest files to the targetStream before calling this method.
Calling this method will shut down the
| |