Class FastThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.opendaylight.yangtools.util.concurrent.FastThreadPoolExecutor
- All Implemented Interfaces:
Executor
,ExecutorService
A ThreadPoolExecutor with a specified bounded queue capacity that favors creating new threads
over queuing, as the former is faster.
See SpecialExecutors.newBoundedFastThreadPool(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
ConstructorsConstructorDescriptionFastThreadPoolExecutor
(int maximumPoolSize, int maximumQueueSize, long keepAliveTime, TimeUnit unit, String threadPrefix, Class<?> loggerIdentity) Constructs a FastThreadPoolExecutor instance.FastThreadPoolExecutor
(int maximumPoolSize, int maximumQueueSize, String threadPrefix, Class<?> loggerIdentity) Constructs a FastThreadPoolExecutor instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected MoreObjects.ToStringHelper
addToStringAttributes
(MoreObjects.ToStringHelper toStringHelper) long
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, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Constructor Details
-
FastThreadPoolExecutor
public FastThreadPoolExecutor(int maximumPoolSize, int maximumQueueSize, String threadPrefix, Class<?> loggerIdentity) Constructs a FastThreadPoolExecutor instance.- Parameters:
maximumPoolSize
- the maximum number of threads to allow in the pool. Threads will terminate after being idle for 15 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.
-
FastThreadPoolExecutor
public FastThreadPoolExecutor(int maximumPoolSize, int maximumQueueSize, long keepAliveTime, TimeUnit unit, String threadPrefix, Class<?> loggerIdentity) Constructs a FastThreadPoolExecutor instance.- Parameters:
maximumPoolSize
- the maximum number of threads to allow in the pool.maximumQueueSize
- the capacity of the queue.keepAliveTime
- the maximum time that idle threads will wait for new tasks before terminating.unit
- the time unit for the keepAliveTime argumentthreadPrefix
- 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
-
getLargestQueueSize
public long getLargestQueueSize() -
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper) -
toString
- Overrides:
toString
in classThreadPoolExecutor
-