21.4.2 Thread pool and queues used in non-daemon Work
The non-daemon Work is processed using the thread pool and queues. The thread pool and queues used for the process are created in the unit of WorkManager, which is defined in the DD. Set the maximum size of threads that can be pooled in a thread pool. The following section describes the maximum size of threads that can be pooled and relation and operation of the number of threads in a pool, when the non-daemon Work is scheduled.
-
If threads in a pool are less than the maximum number of threads in a thread pool
Create a thread and execute the non-daemon Work. The thread is generated irrespective of whether any blank thread exists in thread pool.
-
If a pool contains threads of the same number as the number of the maximum threads in a thread pool
Use blank threads in the thread pool and execute the non-daemon Work. If no blank thread exists, the scheduled non-daemon Work is stored in queue. The non-daemon Work, which is stored in the queue, is executed when a blank thread is available.
The maximum number of threads in a thread pool is 10 by default. To change the maximum number of threads, see 21.4.5 Settings in the execution environment. There is no limit for a queue size.
- Tip
-
When you attempt to stop WorkManager, the stop process starts after WorkManager being executed and all the WorkManager processes stored in the queue end. WorkManager, which is stored in the queue is executed even if WorkManager is stopped when storing in a queue.