Class CachedThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.opendaylight.yangtools.util.concurrent.CachedThreadPoolExecutor
- All Implemented Interfaces:
AutoCloseable
,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.ToStringHelper
addToStringAttributes
(MoreObjects.ToStringHelper toStringHelper) long
getQueue()
void
final String
toString()
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, terminated
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
close
-
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:
setRejectedExecutionHandler
in classThreadPoolExecutor
-
getRejectedExecutionHandler
- Overrides:
getRejectedExecutionHandler
in classThreadPoolExecutor
-
getQueue
- Overrides:
getQueue
in classThreadPoolExecutor
-
getLargestQueueSize
public long getLargestQueueSize() -
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper) -
toString
- Overrides:
toString
in classThreadPoolExecutor
-