public class SRThreadPoolExecutor extends ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
SRThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
Creates a new
ThreadPoolExecutor with the given initial
parameters and default thread factory and rejected execution handler. |
SRThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler)
Creates a new
ThreadPoolExecutor with the given initial
parameters and default thread factory. |
SRThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory)
Creates a new
ThreadPoolExecutor with the given initial
parameters and default rejected execution handler. |
SRThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
Creates a new
ThreadPoolExecutor with the given initial
parameters. |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, 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, toString
public SRThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)
ThreadPoolExecutor
with the given initial
parameters and default thread factory and rejected execution handler.
It may be more convenient to use one of the Executors
factory
methods instead of this general purpose constructor.corePoolSize
- the number of threads to keep in the pool, even
if they are idle, unless allowCoreThreadTimeOut
is setmaximumPoolSize
- the maximum number of threads to allow in the
poolkeepAliveTime
- when the number of threads is greater than
the core, this is the maximum time that excess idle threads
will wait for new tasks before terminating.unit
- the time unit for the keepAliveTime
argumentworkQueue
- the queue to use for holding tasks before they are
executed. This queue will hold only the Runnable
tasks submitted by the execute
method.IllegalArgumentException
- if one of the following holds:corePoolSize < 0
keepAliveTime < 0
maximumPoolSize <= 0
maximumPoolSize < corePoolSize
NullPointerException
- if workQueue
is nullpublic SRThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)
ThreadPoolExecutor
with the given initial
parameters and default thread factory.corePoolSize
- the number of threads to keep in the pool, even
if they are idle, unless allowCoreThreadTimeOut
is setmaximumPoolSize
- the maximum number of threads to allow in the
poolkeepAliveTime
- when the number of threads is greater than
the core, this is the maximum time that excess idle threads
will wait for new tasks before terminating.unit
- the time unit for the keepAliveTime
argumentworkQueue
- the queue to use for holding tasks before they are
executed. This queue will hold only the Runnable
tasks submitted by the execute
method.handler
- the handler to use when execution is blocked
because the thread bounds and queue capacities are reachedIllegalArgumentException
- if one of the following holds:corePoolSize < 0
keepAliveTime < 0
maximumPoolSize <= 0
maximumPoolSize < corePoolSize
NullPointerException
- if workQueue
or handler
is nullpublic SRThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)
ThreadPoolExecutor
with the given initial
parameters and default rejected execution handler.corePoolSize
- the number of threads to keep in the pool, even
if they are idle, unless allowCoreThreadTimeOut
is setmaximumPoolSize
- the maximum number of threads to allow in the
poolkeepAliveTime
- when the number of threads is greater than
the core, this is the maximum time that excess idle threads
will wait for new tasks before terminating.unit
- the time unit for the keepAliveTime
argumentworkQueue
- the queue to use for holding tasks before they are
executed. This queue will hold only the Runnable
tasks submitted by the execute
method.threadFactory
- the factory to use when the executor
creates a new threadIllegalArgumentException
- if one of the following holds:corePoolSize < 0
keepAliveTime < 0
maximumPoolSize <= 0
maximumPoolSize < corePoolSize
NullPointerException
- if workQueue
or threadFactory
is nullpublic SRThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
ThreadPoolExecutor
with the given initial
parameters.corePoolSize
- the number of threads to keep in the pool, even
if they are idle, unless allowCoreThreadTimeOut
is setmaximumPoolSize
- the maximum number of threads to allow in the
poolkeepAliveTime
- when the number of threads is greater than
the core, this is the maximum time that excess idle threads
will wait for new tasks before terminating.unit
- the time unit for the keepAliveTime
argumentworkQueue
- the queue to use for holding tasks before they are
executed. This queue will hold only the Runnable
tasks submitted by the execute
method.threadFactory
- the factory to use when the executor
creates a new threadhandler
- the handler to use when execution is blocked
because the thread bounds and queue capacities are reachedIllegalArgumentException
- if one of the following holds:corePoolSize < 0
keepAliveTime < 0
maximumPoolSize <= 0
maximumPoolSize < corePoolSize
NullPointerException
- if workQueue
or threadFactory
or handler
is nullCopyright © 2013–2023. All rights reserved.