此内容没有您所选择的语言版本。
Chapter 20. 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 20.1, “Component Thread Pool Properties” lists the properties used to configure component thread properties.
| Property | Default | Description |
|---|---|---|
| corePoolSize | 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. |
| maximumPoolSize | 32 | Specifies the maximum number of threads in a thread pool. Setting this property to -1 specifies that it is unbounded. |
| queueSize | 256 | Specifies 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:
- 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 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Example 20.1, “Component Thread Pool Configuration” shows the configuration for a component whose thread pool can have between 10 and 200 threads.
Example 20.1. Component Thread Pool Configuration
corePoolSize = 10
maximumPoolSize = 200
...