Chapter 19. Configuring JBI Component Thread Pools

Abstract

The JBI components included in Red Hat JBoss Fuse use a thread pool to process message exchanges. You can configure each component's thread pool independently.

Overview

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.

Component configuration PIDs

The thread pool properties can be customised for a particular JBI component, ComponentName, by adding the relevant PID to the OSGi Admin service. Each JBI component has a corresponding PID that matches the pattern org.apache.servicemix.components.ComponentName.
The thread pool properties can also be configured using a JMX console.
Important
The component needs to be restarted for changes to take effect.

Thread pool properties

Table 19.1, “Component Thread Pool Properties” lists the properties used to configure component thread properties.

Table 19.1. Component Thread Pool Properties

PropertyDefaultDescription
corePoolSize8Specifies 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.
maximumPoolSize32Specifies the maximum number of threads in a thread pool. Setting this property to -1 specifies that it is unbounded.
queueSize256Specifies the number of jobs allowed in a component's job queue.

Thread selection

When a component receives a new message exchange it choose the thread to process the exchange as follows:
  1. If the component's thread pool is smaller than the corePoolSize, a new thread is created to process the task.
  2. 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.
  3. 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.
  4. The job is processed by the current thread.

Example

Example 19.1, “Component Thread Pool Configuration” shows the configuration for a component whose thread pool can have between 10 and 200 threads.

Example 19.1. Component Thread Pool Configuration

corePoolSize = 10
maximumPoolSize = 200
...