public class DefaultExecutorComponent.ListeningExecutorServiceBuilder
extends java.lang.Object
Constructor and Description |
---|
ListeningExecutorServiceBuilder() |
Modifier and Type | Method and Description |
---|---|
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
allowCoreThreadTimeOut(boolean timeout) |
ListeningExecutorService |
build()
Build the ThreadPoolExecutor using the given configuration.
|
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setCorePoolSize(int corePoolSize) |
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setHandler(java.util.concurrent.RejectedExecutionHandler handler) |
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setKeepAliveTime(long keepAliveTime,
java.util.concurrent.TimeUnit unit)
The amount of time
|
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setMaximumPoolSize(int maximumPoolSize)
The ExecutorService will always prefer adding tasks to the queue over adding threads beyond the core pool size.
|
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setThreadNameFormat(java.lang.String threadNameFormat) |
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setThreadPoolName(java.lang.String threadPoolName)
Set the name of this thread pool.
|
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setWithMetrics(boolean withMetrics) |
DefaultExecutorComponent.ListeningExecutorServiceBuilder |
setWorkQueue(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
This will almost always be a SynchronousQueue or an ArrayBlockingQueue with a reasonable maximum size.
|
public DefaultExecutorComponent.ListeningExecutorServiceBuilder setCorePoolSize(int corePoolSize)
public DefaultExecutorComponent.ListeningExecutorServiceBuilder setMaximumPoolSize(int maximumPoolSize)
More specifically, from the ThreadPoolExecutor javadoc:
maximumPoolSize
- public DefaultExecutorComponent.ListeningExecutorServiceBuilder setKeepAliveTime(long keepAliveTime, java.util.concurrent.TimeUnit unit)
keepAliveTime
- unit
- public DefaultExecutorComponent.ListeningExecutorServiceBuilder allowCoreThreadTimeOut(boolean timeout)
public DefaultExecutorComponent.ListeningExecutorServiceBuilder setWithMetrics(boolean withMetrics)
public DefaultExecutorComponent.ListeningExecutorServiceBuilder setWorkQueue(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
workQueue
- public DefaultExecutorComponent.ListeningExecutorServiceBuilder setThreadNameFormat(java.lang.String threadNameFormat)
threadNameFormat
- a String.format(String, Object...)
-compatible
format String, to which a unique integer (0, 1, etc.) will be supplied
as the single parameter. This integer will be unique to the built
instance of the ThreadFactory and will be assigned sequentially. For
example, "rpc-pool-%d"
will generate thread names like
"rpc-pool-0"
, "rpc-pool-1"
, "rpc-pool-2"
, etc.public DefaultExecutorComponent.ListeningExecutorServiceBuilder setThreadPoolName(java.lang.String threadPoolName)
threadPoolName
- public DefaultExecutorComponent.ListeningExecutorServiceBuilder setHandler(java.util.concurrent.RejectedExecutionHandler handler)
public ListeningExecutorService build()