WildFly Threads Subsystem Concepts: Difference between revisions
Line 7: | Line 7: | ||
Thread pools defined by the "threads" subsystem can be shared between WildFly components that are compatible with the ''executor model''. An example of such components are [[#How_Does_it_Relate_to_JBossWeb.3F|JBoss Web connectors]]. | Thread pools defined by the "threads" subsystem can be shared between WildFly components that are compatible with the ''executor model''. An example of such components are [[#How_Does_it_Relate_to_JBossWeb.3F|JBoss Web connectors]]. | ||
An ''executor'' is an asynchronous execution mechanism capable of executing tasks in the background. The terms "executor" and "thread pool" are equivalent in this context and can be used interchangeably. Also see [[java.util.concurrent Executors]]. | An ''executor'' is an asynchronous execution mechanism capable of executing tasks in the background. The terms "executor" and "thread pool" are equivalent in this context and can be used interchangeably. Also see [[java.util.concurrent Executors]]. There are six built-in executor types: | ||
1. '''unbounded-queue-thread-pool'''. This type of thread pool always accepts tasks for execution: if less than the maximum number of threads are running, a new thread is created and associated with a newly submitted tasks. If the maximum number of threads has been reached and all threads are engaged processing tasks, the task is placed into an inbound FIFO queue to be executed when the thread becomes available. | |||
An executor needs a ''thread factory'', that instantiates the threads required by the executor. The thread factory defines the thread name pattern, the thread priority and the thread group name. The thread factory must be defined within the subsystem configuration and referred to from within the executor definition. | An executor needs a ''thread factory'', that instantiates the threads required by the executor. The thread factory defines the thread name pattern, the thread priority and the thread group name. The thread factory must be defined within the subsystem configuration and referred to from within the executor definition. |
Revision as of 21:19, 8 June 2016
Internal
Executor Model
Thread pools defined by the "threads" subsystem can be shared between WildFly components that are compatible with the executor model. An example of such components are JBoss Web connectors.
An executor is an asynchronous execution mechanism capable of executing tasks in the background. The terms "executor" and "thread pool" are equivalent in this context and can be used interchangeably. Also see java.util.concurrent Executors. There are six built-in executor types:
1. unbounded-queue-thread-pool. This type of thread pool always accepts tasks for execution: if less than the maximum number of threads are running, a new thread is created and associated with a newly submitted tasks. If the maximum number of threads has been reached and all threads are engaged processing tasks, the task is placed into an inbound FIFO queue to be executed when the thread becomes available.
An executor needs a thread factory, that instantiates the threads required by the executor. The thread factory defines the thread name pattern, the thread priority and the thread group name. The thread factory must be defined within the subsystem configuration and referred to from within the executor definition.
For details on how to configure an executor and its associated thread factory, see: