Class Archive.ExtractorExecutorHolder
java.lang.Object
com.github.junrar.Archive.ExtractorExecutorHolder
- Enclosing class:
Archive
Class to ensure the lazy initialization of the
ThreadPoolExecutor upon 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.
- Version:
- $LastChangedRevision$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ExecutorServiceEquivalent toExecutors.newCachedThreadPool(), but customizable through system properties.private static final AtomicLong -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intprivate static int
-
Field Details
-
threadIndex
-
cachedExecutorService
Equivalent toExecutors.newCachedThreadPool(), but customizable through system properties.
-
-
Constructor Details
-
ExtractorExecutorHolder
private ExtractorExecutorHolder()
-
-
Method Details
-
getMaxThreads
private static int getMaxThreads() -
getThreadKeepAlive
private static int getThreadKeepAlive()
-