Class CachedThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.opendaylight.yangtools.util.concurrent.CachedThreadPoolExecutor
- All Implemented Interfaces:
Executor,ExecutorService
A ThreadPoolExecutor with a specified bounded queue capacity that favors reusing previously
constructed threads, when they are available, over creating new threads.
See SpecialExecutors.newBoundedCachedThreadPool(int, int, java.lang.String, java.lang.Class<?>) for more details.
- Author:
- Thomas Pantelis
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Constructor Summary
ConstructorsConstructorDescriptionCachedThreadPoolExecutor(int maximumPoolSize, int maximumQueueSize, String threadPrefix, Class<?> loggerIdentity) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected MoreObjects.ToStringHelperaddToStringAttributes(MoreObjects.ToStringHelper toStringHelper) longgetQueue()voidfinal StringtoString()Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setThreadFactory, shutdown, shutdownNow, terminatedMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Constructor Details
-
CachedThreadPoolExecutor
public CachedThreadPoolExecutor(int maximumPoolSize, int maximumQueueSize, String threadPrefix, Class<?> loggerIdentity) Constructs an instance.- Parameters:
maximumPoolSize- the maximum number of threads to allow in the pool. Threads will terminate after being idle for 60 seconds.maximumQueueSize- the capacity of the queue.threadPrefix- the name prefix for threads created by this executor.loggerIdentity- the class to use as logger name for logging uncaught exceptions from the threads.
-
-
Method Details
-
setRejectedExecutionHandler
- Overrides:
setRejectedExecutionHandlerin classThreadPoolExecutor
-
getRejectedExecutionHandler
- Overrides:
getRejectedExecutionHandlerin classThreadPoolExecutor
-
getQueue
- Overrides:
getQueuein classThreadPoolExecutor
-
getLargestQueueSize
public long getLargestQueueSize() -
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper) -
toString
- Overrides:
toStringin classThreadPoolExecutor
-