org.apache.servicemix.executors.impl
Class ExecutorFactoryImpl

java.lang.Object
  extended by org.apache.servicemix.executors.impl.ExecutorFactoryImpl
All Implemented Interfaces:
ExecutorFactory

public class ExecutorFactoryImpl
extends java.lang.Object
implements ExecutorFactory

Default implementation of the ExecutorFactory.

Configuration can be done hierachically. When an executor is created with an id of foo.bar, the factory will look for a configuration in the following way:

Author:
Guillaume Nodet

Field Summary
 
Fields inherited from interface org.apache.servicemix.executors.ExecutorFactory
ALLOW_CORE_THREADS_TIMEOUT, BYPASS_IF_SYNCHRONOUS, CORE_POOL_SIZE, KEEP_ALIVE_TIME, MAXIMUM_POOL_SIZE, QUEUE_SIZE, SHUTDOWN_DELAY, THREAD_DAEMON, THREAD_PRIORITY
 
Constructor Summary
ExecutorFactoryImpl()
           
 
Method Summary
 Executor createDaemonExecutor(java.lang.String id)
          Create a new daemon executor for the given Id.
 Executor createExecutor(java.lang.String id)
          Create a new executor for the given Id.
 Executor createExecutor(java.lang.String id, java.util.Map<java.lang.String,java.lang.Object> configuration)
          Create a new executor for the given id using the additional configuration options provided.
protected  java.util.concurrent.ThreadPoolExecutor createService(java.lang.String id, ExecutorConfig config)
           
protected  ExecutorConfig getConfig(java.lang.String id)
           
 java.util.Map<java.lang.String,ExecutorConfig> getConfigs()
           
 ExecutorConfig getDefaultConfig()
           
 org.fusesource.commons.management.ManagementStrategy getManagementStrategy()
           
 javax.management.MBeanServer getMbeanServer()
           
 void setConfigs(java.util.Map<java.lang.String,ExecutorConfig> configs)
           
 void setDefaultConfig(ExecutorConfig defaultConfig)
           
 void setManagementStrategy(org.fusesource.commons.management.ManagementStrategy managementStrategy)
           
 void setMbeanServer(javax.management.MBeanServer mbeanServer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutorFactoryImpl

public ExecutorFactoryImpl()
Method Detail

createExecutor

public Executor createExecutor(java.lang.String id)
Description copied from interface: ExecutorFactory
Create a new executor for the given Id. The id may be used to provide per executor configuration.

Specified by:
createExecutor in interface ExecutorFactory
Parameters:
id - the id of the executor to create
Returns:
a configured Executor

createExecutor

public Executor createExecutor(java.lang.String id,
                               java.util.Map<java.lang.String,java.lang.Object> configuration)
Description copied from interface: ExecutorFactory
Create a new executor for the given id using the additional configuration options provided. Note that not every ExecutorFactory implementation will support all available options. If the factory does not support the option, it will get ignored.

Specified by:
createExecutor in interface ExecutorFactory
Parameters:
id - the id of the executor to create
configuration - the additional executor configuration options
Returns:
a configured Executor

createDaemonExecutor

public Executor createDaemonExecutor(java.lang.String id)
Description copied from interface: ExecutorFactory
Create a new daemon executor for the given Id. The excutor should use daemon thread underlying The id may be used to provide per executor configuration.

Specified by:
createDaemonExecutor in interface ExecutorFactory
Parameters:
id - the id of the executor to create
Returns:
a configured Executor

getConfig

protected ExecutorConfig getConfig(java.lang.String id)

createService

protected java.util.concurrent.ThreadPoolExecutor createService(java.lang.String id,
                                                                ExecutorConfig config)

getConfigs

public java.util.Map<java.lang.String,ExecutorConfig> getConfigs()
Returns:
the configs

setConfigs

public void setConfigs(java.util.Map<java.lang.String,ExecutorConfig> configs)
Parameters:
configs - the configs to set

getDefaultConfig

public ExecutorConfig getDefaultConfig()
Returns:
the defaultConfig

setDefaultConfig

public void setDefaultConfig(ExecutorConfig defaultConfig)
Parameters:
defaultConfig - the defaultConfig to set

getMbeanServer

public javax.management.MBeanServer getMbeanServer()

setMbeanServer

public void setMbeanServer(javax.management.MBeanServer mbeanServer)

getManagementStrategy

public org.fusesource.commons.management.ManagementStrategy getManagementStrategy()

setManagementStrategy

public void setManagementStrategy(org.fusesource.commons.management.ManagementStrategy managementStrategy)


Copyright © 2005-2011 FuseSource. All Rights Reserved.