Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

From version 3.1, ServiceMix now uses separate and configurable thread pools for each component and SEDA queueflow, which allow much more tuning when needed.

...

Following is an example configuration of the factory:

Code Block
langxml
xml
<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="componentflow.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="componentflow.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>

...

  • if the number of threads is less than corePoolSize, the executor will create a new thread to handle the job
  • if the number of queued jobs is less than queueSize, the job is queued
  • is if the queue is full and the number of threads is less than maximumPoolSize, a new thread is created to handle the job
  • else, the current thread will handle the job

...