Class CachedThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.opendaylight.yangtools.util.concurrent.CachedThreadPoolExecutor
-
- All Implemented Interfaces:
Executor
,ExecutorService
public class CachedThreadPoolExecutor extends ThreadPoolExecutor
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
Constructors Constructor Description CachedThreadPoolExecutor(int maximumPoolSize, int maximumQueueSize, String threadPrefix, Class<?> loggerIdentity)
Constructs an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MoreObjects.ToStringHelper
addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
long
getLargestQueueSize()
BlockingQueue<Runnable>
getQueue()
RejectedExecutionHandler
getRejectedExecutionHandler()
void
setRejectedExecutionHandler(RejectedExecutionHandler handler)
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
-
-
-
-
Constructor Detail
-
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 Detail
-
setRejectedExecutionHandler
public void setRejectedExecutionHandler(RejectedExecutionHandler handler)
- Overrides:
setRejectedExecutionHandler
in classThreadPoolExecutor
-
getRejectedExecutionHandler
public RejectedExecutionHandler getRejectedExecutionHandler()
- Overrides:
getRejectedExecutionHandler
in classThreadPoolExecutor
-
getQueue
public BlockingQueue<Runnable> getQueue()
- Overrides:
getQueue
in classThreadPoolExecutor
-
getLargestQueueSize
public long getLargestQueueSize()
-
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
-
toString
public final String toString()
- Overrides:
toString
in classThreadPoolExecutor
-
-