Package org.omegazero.common.event
Class TaskQueueExecutor.Builder
java.lang.Object
org.omegazero.common.event.TaskQueueExecutor.Builder
- Enclosing class:
TaskQueueExecutor
Builder used to create a
TaskQueueExecutor.
A TaskQueueExecutor backed by any queue may be created using TaskQueueExecutor.from(Queue), or with any of the predefined backing queues using
TaskQueueExecutor.fromPriority() and TaskQueueExecutor.fromSequential().
- Since:
- 2.6
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aTaskQueueExecutorwith previously set parameters.daemon(boolean daemon) Sets whether worker threads of theTaskQueueExecutorshould be daemon threads.Sets worker thread name prefix for theTaskQueueExecutor.workerThreads(int maxWorkerThreadCount) Sets the maximum number of worker threads allowed for theTaskQueueExecutor.
-
Method Details
-
workerThreads
Sets the maximum number of worker threads allowed for theTaskQueueExecutor. This method may be called with a negative value to set the maximum number to its absolute value or the number of processors available, whichever is greater. For example, passing-2sets the maximum number of worker threads to2, or the number of processors if there are more than 2.The default value is
1.- Parameters:
maxWorkerThreadCount- The maximum number of worker threads- Returns:
- This builder
-
daemon
Sets whether worker threads of theTaskQueueExecutorshould be daemon threads. Setting this totruewill not require an explicit call toTaskQueueExecutor.exit(boolean)for the VM to exit.The default value is
false.- Parameters:
daemon- Whether worker threads should be daemon threads- Returns:
- This builder
-
name
Sets worker thread name prefix for theTaskQueueExecutor.The default value is
"TaskExecutor".- Parameters:
threadName- The thread name prefix- Returns:
- This builder
-
build
Builds aTaskQueueExecutorwith previously set parameters.- Returns:
- The new
TaskQueueExecutor - See Also:
-