Package com.github.junrar
Class Archive.ExtractorExecutorHolder
- java.lang.Object
-
- com.github.junrar.Archive.ExtractorExecutorHolder
-
- Enclosing class:
- Archive
private static final class Archive.ExtractorExecutorHolder extends java.lang.ObjectClass to ensure the lazy initialization of theThreadPoolExecutorupon first usage.
Using a cached thread pool executor is more efficient and creating a new thread for each extraction. The total number of threads will only increase if there are tasks on its queue and all current threads are busy. If there are available threads, those will be reused instead of a new one being created.
Configuration options:
- To avoid the possibility of too many simultaneous active threads being started, the maximum
number of threads can be configured through the
junrar.extractor.max-threadssystem property. The default maximum number of threads is unbounded. - The keep alive time can be configured through the
junrar.extractor.thread-keep-alive-secondssystem property. The default is 5s.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ExecutorServicecachedExecutorServiceEquivalent toExecutors.newCachedThreadPool(), but customizable through system properties.private static java.util.concurrent.atomic.AtomicLongthreadIndex
-
Constructor Summary
Constructors Modifier Constructor Description privateExtractorExecutorHolder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static intgetMaxThreads()private static intgetThreadKeepAlive()
-