Thread Pool

A thread pool is a queue of threads available to run a queue of tasks. Thread pools are used to improve performance when executing large numbers of asynchronous tasks by reducing per-task invocation overhead and provide a means of bounding and managing the resources consumed when executing a collection of tasks.

A thread pool is created with zero threads.

General
Field Required? Editable? Accepts SVars? Description

Note: If no value is specified for Core pool size, Max Pool Size, and, Keep Alive Time fields, then the default values are used.

Core Pool Size N Y Y

When a new task is submitted and fewer than Core Pool Size threads are running, a new thread is created to handle the request, even if other threads are idle.

If there are greater than Core Pool Size but fewer than Max Pool Size threads running, a new thread is created only if no threads are idle.

Must be greater than or equal to zero.

Note: When a Java or Spring component service is configured with a threading policy with a non-zero timeout value and is promoted to a composite service using a SOAP or JMS binding, concurrency is halved because two threads are used per request. To achieve the desired concurrency, specify double the number of threads for the thread pool size.

Default: 2 (that is, two threads are used to service one request: one for receiving the request and one for receiving the response)

Max Pool Size N Y Y

The maximum number of threads in the pool.

Must be greater than zero and greater than or equal to Core Pool Size.

Default: 20

Keep Alive Time (s) N Y Y The time for which an idle thread remains in the pool before being reclaimed if the number of threads in pool is more than Core Pool Size.

Default: 30 Seconds

Autostart Core Threads N N N Indicates that the Core Pool Size threads must be created and started when the thread pool is created. Normally core threads are created and started only when new tasks arrive.

Default: false

Thread Pool Name Prefix N Y Y A string prepended to the name of each thread.

Default: <pool-poolnumber-thread-threadnumber>

Priority Y N N The default priority of the threads in the pool.

Default: 5

Rejection Policy Y N N

The policy applied when no thread is available to run a task:

  • Abort - The task is aborted and an exception is thrown.
  • Blocking - The task is blocked until a thread from thread pool picks up this task.
  • Caller Runs - The task is run in the calling thread.

Default: Blocking

Daemon N N N Indicates whether the threads can be started as daemon or user.

Default: Unchecked