public class ExecutorComponent.ListeningExecutorServiceBuilder
extends java.lang.Object
Constructor and Description |
---|
ListeningExecutorServiceBuilder() |
Modifier and Type | Method and Description |
---|---|
ExecutorComponent.ListeningExecutorServiceBuilder |
allowCoreThreadTimeOut(boolean timeout) |
ListeningExecutorService |
build()
Build the ThreadPoolExecutor using the given configuration.
|
ExecutorComponent.ListeningExecutorServiceBuilder |
setCorePoolSize(int corePoolSize) |
ExecutorComponent.ListeningExecutorServiceBuilder |
setHandler(java.util.concurrent.RejectedExecutionHandler handler) |
ExecutorComponent.ListeningExecutorServiceBuilder |
setKeepAliveTime(long keepAliveTime,
java.util.concurrent.TimeUnit unit)
The amount of time
|
ExecutorComponent.ListeningExecutorServiceBuilder |
setMaximumPoolSize(int maximumPoolSize)
The ExecutorService will always prefer adding tasks to the queue over adding threads beyond the core pool size.
|
ExecutorComponent.ListeningExecutorServiceBuilder |
setThreadNameFormat(java.lang.String threadNameFormat) |
ExecutorComponent.ListeningExecutorServiceBuilder |
setThreadPoolName(java.lang.String threadPoolName)
Set the name of this thread pool.
|
ExecutorComponent.ListeningExecutorServiceBuilder |
setWithMetrics(boolean withMetrics) |
ExecutorComponent.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 ExecutorComponent.ListeningExecutorServiceBuilder setCorePoolSize(int corePoolSize)
public ExecutorComponent.ListeningExecutorServiceBuilder setMaximumPoolSize(int maximumPoolSize)
More specifically, from the ThreadPoolExecutor javadoc:
maximumPoolSize
- public ExecutorComponent.ListeningExecutorServiceBuilder setKeepAliveTime(long keepAliveTime, java.util.concurrent.TimeUnit unit)
keepAliveTime
- unit
- public ExecutorComponent.ListeningExecutorServiceBuilder allowCoreThreadTimeOut(boolean timeout)
public ExecutorComponent.ListeningExecutorServiceBuilder setWithMetrics(boolean withMetrics)
public ExecutorComponent.ListeningExecutorServiceBuilder setWorkQueue(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
workQueue
- public ExecutorComponent.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 ExecutorComponent.ListeningExecutorServiceBuilder setThreadPoolName(java.lang.String threadPoolName)
threadPoolName
- public ExecutorComponent.ListeningExecutorServiceBuilder setHandler(java.util.concurrent.RejectedExecutionHandler handler)
public ListeningExecutorService build()