The JBI components are multi-threaded. Each one maintains a thread pool that it uses to process message exchanges. These thread pools are configured using three properties that control the minimum number of threads in the pool, the maximum number of threads in the pool, and the depth of the component's job queue.
These properties are specified in the component configuration files in the
folder. The component configuration files are named using the scheme InstallDir
/etc
. For example, the configuration file for the JMS file component would be ComponentName
.cfgservicemix-file.cfg
.
The thread pool properties can also be configured using a JMX console.
![]() | Important |
---|---|
The component needs to be restarted for changes to take effect. |
Table 7.1 lists the properties used to configure component thread properties.
Table 7.1. Component Thread Pool Properties
Property | Default | Description |
---|---|---|
threadPoolCorePoolSize | 8 | Specifies the minimum number of threads in a thread pool. If the number of available threads drops below this limit, the runtime will always create a new thread to handle the job. |
threadPoolMaximumPoolSize | 32 | Specifies the maximum number of threads in a thread pool. Setting this property to -1 specifies that it is unbounded. |
threadPoolQueueSize | 256 | Specifies the number of jobs allowed in a component's job queue. |
When a component receives a new message exchange it choose the thread to process the exchange as follows:
If the component's thread pool is smaller than the corePoolSize, a new thread is created to process the task.
If less than queueSize jobs are in the component's job queue, the task is placed on the queue to wait for a free thread.
If the component's job queue is full and the thread pool has less than maximumPoolSize threads instantiated, a new thread is created to process the task.
The job is processed by the current thread.
Example 7.1 shows the configuration for a component whose thread pool can have between 10 and 200 threads.
Example 7.1. Component Thread Pool Configuration
... threadPoolCorePoolSize = 10 threadPoolMaximumPoolSize = 200 ...