Class ParallelOptions


  • public class ParallelOptions
    extends Object

    Options for parallel compression.

    
        try (Archive archive = new Archive()) {
            archive.createEntries("DirToCompress");
            ParallelOptions parallelOptions = new ParallelOptions();
            parallelOptions.setParallelCompressInMemory(mode);
            parallelOptions.setAvailableMemorySize(4000);
            ArchiveSaveOptions archiveSaveOptions = new ArchiveSaveOptions();
            archiveSaveOptions.setParallelOptions(parallelOptions);
            archive.save("archive.zip", archiveSaveOptions);
        }
     

    These options manage simultaneous compression by several CPU cores.

    • Constructor Detail

      • ParallelOptions

        public ParallelOptions()
    • Method Detail

      • getParallelCompressInMemory

        public final ParallelCompressionMode getParallelCompressInMemory()

        Gets value indicating how parallel approach to be used.

        Returns:
        value indicating how parallel approach to be used.
      • setParallelCompressInMemory

        public final void setParallelCompressInMemory​(ParallelCompressionMode value)

        Sets value indicating how parallel approach to be used.

        Parameters:
        value - value indicating how parallel approach to be used.
      • getAvailableMemorySize

        public final int getAvailableMemorySize()

        Gets memory estimate in megabytes available to accomodate compressed entries without a swap to disk. This value only makes sense if getParallelCompressInMemory() setting is in ParallelCompressionMode.Auto mode.

        This value is used to calculate the biggest size of entry that can be compressed in parallel with others. All entries above the calculated threshold will be compressed sequentially. It is safe to have getAvailableMemorySize() property as big as free RAM and even bigger. By default it is assumed you have at least 200MB per CPU core.

        Returns:
        memory estimate in megabytes available to accomodate compressed entries without a swap to disk.
      • setAvailableMemorySize

        public final void setAvailableMemorySize​(int value)

        Sets memory estimate in megabytes available to accomodate compressed entries without a swap to disk. This value only makes sense if getParallelCompressInMemory() setting is in ParallelCompressionMode.Auto mode.

        This value is used to calculate the biggest size of entry that can be compressed in parallel with others. All entries above the calculated threshold will be compressed sequentially. It is safe to have getAvailableMemorySize() property as big as free RAM and even bigger. By default it is assumed you have at least 200MB per CPU core.

        Parameters:
        value - memory estimate in megabytes available to accomodate compressed entries without a swap to disk.