public static class TimedExecutorService.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder()
Creates the builder and sets default values
|
Modifier and Type | Method and Description |
---|---|
TimedExecutorService |
build() |
TimedExecutorService.Builder |
corePoolSize(int corePoolSize)
Sets the core pool size.
|
TimedExecutorService.Builder |
defaultRunDuration(long defaultRunDuration)
Sets the default run duration in milliseconds for a newly submitted task
|
TimedExecutorService.Builder |
keepAliveTime(long keepAliveTime)
Sets the number of milliseconds to keep idle threads alive
|
TimedExecutorService.Builder |
keepAliveTime(long keepAliveTime,
java.util.concurrent.TimeUnit unit)
Sets the time to keep idle threads alive
|
TimedExecutorService.Builder |
maximumPoolSize(int maximumPoolSize)
Sets the maximum pool size.
|
TimedExecutorService.Builder |
numCancellerThreads(int numCancellerThreads)
Sets the number of canceller threads to use for monitoring tasks.
|
TimedExecutorService.Builder |
rejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Sets the way to handle rejected tasks
|
TimedExecutorService.Builder |
removeOnCancel(boolean removeOnCancel)
Sets whether or not cancelling a future should immediately remove it from the task cancellation queue.
|
TimedExecutorService.Builder |
threadFactory(java.util.concurrent.ThreadFactory threadFactory)
Sets the Thread Factory to use for thread generation
|
java.lang.String |
toString() |
TimedExecutorService.Builder |
workQueue(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
Sets the work queue.
|
@NotNull public TimedExecutorService.Builder corePoolSize(int corePoolSize)
corePoolSize
- The core pool size, or how many threads to have minimum at any given time@NotNull public TimedExecutorService.Builder maximumPoolSize(int maximumPoolSize)
maximumPoolSize
- The max pool size, or how many threads to have maximum at any given time@NotNull public TimedExecutorService.Builder keepAliveTime(long keepAliveTime, @NotNull java.util.concurrent.TimeUnit unit)
keepAliveTime
- The time to keep idle threads aliveunit
- The measurement unit for the time@NotNull public TimedExecutorService.Builder keepAliveTime(long keepAliveTime)
keepAliveTime
- The number of milliseconds to keep idle threads alive@NotNull public TimedExecutorService.Builder workQueue(@Nullable java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
workQueue
- The work queue to use, or null to use a default. Each call to build will also null the work queue for the next build call@NotNull public TimedExecutorService.Builder threadFactory(@Nullable java.util.concurrent.ThreadFactory threadFactory)
threadFactory
- The factory to use for thread generation, or null for the default@NotNull public TimedExecutorService.Builder rejectedExecutionHandler(@Nullable java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
rejectedExecutionHandler
- The handler for rejected tasks@NotNull public TimedExecutorService.Builder defaultRunDuration(long defaultRunDuration)
defaultRunDuration
- The default run duration in milliseconds@NotNull public TimedExecutorService.Builder removeOnCancel(boolean removeOnCancel)
removeOnCancel
- Whether or not cancelling a future should immediately remove it from the task cancellation queue.@NotNull public TimedExecutorService.Builder numCancellerThreads(int numCancellerThreads)
numCancellerThreads
- The number of canceller threads to use for monitoring tasks.@NotNull public TimedExecutorService build()
@NotNull public java.lang.String toString()
toString
in class java.lang.Object