|
Page Edited :
SM :
Thread pools
Thread pools has been edited by Bruce Snyder (Mar 25, 2008). Content:Configuring the Component Thread PoolsFrom version 3.1, ServiceMix now uses separate and configurable thread pools for each component and flow, which allow much more tuning when needed. By default, all components and SEDA queues will create its own thread pool through the org.apache.servicemix.executors.ExecutorFactory. Each of these thread pools can be configured using a number of parameters:
Each thread pool has its own identifier, for example:
Thread pools are configured hierarchically using these ids. It means that when an executor is created with an id of <code>foo.bar</code>, the factory will look for a configuration in the following way:
ExamplesFollowing is an example configuration of the factory: <sm:container ...> <sm:executorFactory> <bean class="org.apache.servicemix.executors.impl.ExecutorFactoryImpl"> <property name="defaultConfig"> <bean class="org.apache.servicemix.executors.impl.ExecutorConfig"> <property name="corePoolSize" value="4"/> <property name="maximumPoolSize" value="-1"/> <property name="queueSize" value="0"/> </bean> </property> <property name="configs"> <map> <entry key="flow.jms.servicemix-http"> <bean class="org.apache.servicemix.executors.impl.ExecutorConfig"> <property name="corePoolSize" value="32"/> <property name="maximumPoolSize" value="-1"/> <property name="queueSize" value="1024"/> </bean> </entry> <entry key="flow.seda.servicemix-jsr181"> <bean class="org.apache.servicemix.executors.impl.ExecutorConfig"> <property name="corePoolSize" value="2"/> <property name="maximumPoolSize" value="4"/> <property name="queueSize" value="-1"/> </bean> </entry> </map> </property> </bean> </sm:executorFactory> ... </sm:container>
When the executor receives a new task, the following happen:
Note that maximumPoolSize and queueSize can be set to -1 to not bound these values. Additional InformationThe thread pools behavior is a function of how the ThreadPoolExecutor from the JavaSE works. When the ThreadPoolExecutor is configured by the ServiceMix ExecutorFactoryImpl.createService() method, it does so using the corePoolSize and the maximumPoolSize properties from the conf/servicemix.properties file. The ThreadPoolExecutor then uses the values set using those properties to influence how the size of the thread pool is adjusted at runtime. For more information, see the ThreadPoolExecutor's Javadoc |
Unsubscribe or edit your notifications preferences
