public static final class EnhancedQueueExecutor.Builder extends Object
EnhancedQueueExecutor
. All the fields are initialized to sensible defaults for
a small thread pool.Constructor and Description |
---|
Builder()
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
EnhancedQueueExecutor.Builder |
allowCoreThreadTimeOut(boolean allowCoreTimeOut)
Establish whether core threads are allowed to time out.
|
boolean |
allowsCoreThreadTimeOut()
Determine whether core threads are allowed to time out.
|
EnhancedQueueExecutor |
build()
Construct the executor from the configured parameters.
|
int |
getCorePoolSize()
Get the core pool size.
|
Thread.UncaughtExceptionHandler |
getExceptionHandler()
Get the uncaught exception handler.
|
float |
getGrowthResistance()
Get the thread pool growth resistance.
|
Executor |
getHandoffExecutor()
Get the handoff executor.
|
long |
getKeepAliveTime(TimeUnit keepAliveUnits)
Get the thread keep-alive time.
|
int |
getMaximumPoolSize()
Get the maximum pool size.
|
int |
getMaximumQueueSize()
Get the maximum queue size.
|
String |
getMBeanName()
Get the overridden MBean name.
|
Runnable |
getTerminationTask()
Get the termination task.
|
ThreadFactory |
getThreadFactory()
Get the configured thread factory.
|
boolean |
isRegisterMBean()
Determine whether an MBean should automatically be registered for this pool.
|
EnhancedQueueExecutor.Builder |
setCorePoolSize(int coreSize)
Set the core pool size.
|
EnhancedQueueExecutor.Builder |
setExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
Set the uncaught exception handler.
|
EnhancedQueueExecutor.Builder |
setGrowthResistance(float growthResistance)
Set the thread pool growth resistance.
|
EnhancedQueueExecutor.Builder |
setHandoffExecutor(Executor handoffExecutor)
Set the handoff executor.
|
EnhancedQueueExecutor.Builder |
setKeepAliveTime(long keepAliveTime,
TimeUnit keepAliveUnits)
Set the thread keep-alive time.
|
EnhancedQueueExecutor.Builder |
setMaximumPoolSize(int maxSize)
Set the maximum pool size.
|
EnhancedQueueExecutor.Builder |
setMaximumQueueSize(int maxQueueSize)
Set the maximum queue size.
|
EnhancedQueueExecutor.Builder |
setMBeanName(String mBeanName)
Set the overridden MBean name.
|
EnhancedQueueExecutor.Builder |
setRegisterMBean(boolean registerMBean)
Establish whether an MBean should automatically be registered for this pool.
|
EnhancedQueueExecutor.Builder |
setTerminationTask(Runnable terminationTask)
Set the termination task.
|
EnhancedQueueExecutor.Builder |
setThreadFactory(ThreadFactory threadFactory)
Set the configured thread factory.
|
public ThreadFactory getThreadFactory()
null
)public EnhancedQueueExecutor.Builder setThreadFactory(ThreadFactory threadFactory)
threadFactory
- the configured thread factory (must not be null
)public Runnable getTerminationTask()
Runnable
is used.null
)public EnhancedQueueExecutor.Builder setTerminationTask(Runnable terminationTask)
terminationTask
- the termination task (must not be null
)public int getCorePoolSize()
EnhancedQueueExecutor.getCorePoolSize()
public EnhancedQueueExecutor.Builder setCorePoolSize(int coreSize)
coreSize
- the core pool size (must be greater than or equal to 0, and less than 2^20)EnhancedQueueExecutor.setCorePoolSize(int)
public int getMaximumPoolSize()
EnhancedQueueExecutor.getMaximumPoolSize()
public EnhancedQueueExecutor.Builder setMaximumPoolSize(int maxSize)
maxSize
- the maximum pool size (must be greater than or equal to 0, and less than 2^20)EnhancedQueueExecutor.setMaximumPoolSize(int)
public long getKeepAliveTime(TimeUnit keepAliveUnits)
keepAliveUnits
- the time keepAliveUnits of the keep-alive time (must not be null
)EnhancedQueueExecutor.getKeepAliveTime(TimeUnit)
public EnhancedQueueExecutor.Builder setKeepAliveTime(long keepAliveTime, TimeUnit keepAliveUnits)
keepAliveTime
- the thread keep-alive time (must be greater than 0)keepAliveUnits
- the time keepAliveUnits of the keep-alive time (must not be null
)EnhancedQueueExecutor.setKeepAliveTime(long, TimeUnit)
public float getGrowthResistance()
0.0
indicates that tasks should
not be enqueued until the pool is completely full; a value of 1.0
indicates that tasks should always
be enqueued until the queue is completely full.EnhancedQueueExecutor.getGrowthResistance()
public EnhancedQueueExecutor.Builder setGrowthResistance(float growthResistance)
growthResistance
- the thread pool growth resistance (must be in the range 0.0f ≤ n ≤ 1.0f
)getGrowthResistance()
,
EnhancedQueueExecutor.setGrowthResistance(float)
public boolean allowsCoreThreadTimeOut()
true
if core threads are allowed to time out, false
otherwiseEnhancedQueueExecutor.allowsCoreThreadTimeOut()
public EnhancedQueueExecutor.Builder allowCoreThreadTimeOut(boolean allowCoreTimeOut)
allowCoreTimeOut
- true
if core threads are allowed to time out, false
otherwiseEnhancedQueueExecutor.allowCoreThreadTimeOut(boolean)
public int getMaximumQueueSize()
EnhancedQueueExecutor.getMaximumQueueSize()
public EnhancedQueueExecutor.Builder setMaximumQueueSize(int maxQueueSize)
maxQueueSize
- the maximum queue size (must be ≥ 0)EnhancedQueueExecutor.setMaximumQueueSize(int)
public Executor getHandoffExecutor()
null
)public EnhancedQueueExecutor.Builder setHandoffExecutor(Executor handoffExecutor)
handoffExecutor
- the handoff executor (must not be null
)public Thread.UncaughtExceptionHandler getExceptionHandler()
null
)public EnhancedQueueExecutor.Builder setExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
exceptionHandler
- the uncaught exception handler (must not be null
)public EnhancedQueueExecutor build()
null
)public boolean isRegisterMBean()
true
if an MBean is to be auto-registered; false
otherwisepublic EnhancedQueueExecutor.Builder setRegisterMBean(boolean registerMBean)
registerMBean
- true
if an MBean is to be auto-registered; false
otherwisepublic String getMBeanName()
null
if a default name should be generatedpublic EnhancedQueueExecutor.Builder setMBeanName(String mBeanName)
mBeanName
- the overridden MBean name, or null
if a default name should be generatedCopyright © 2023 JBoss by Red Hat. All rights reserved.