org.apache.mina.integration.spring
Class ThreadPoolExecutorFactoryBean

java.lang.Object
  extended by org.springframework.beans.factory.config.AbstractFactoryBean
      extended by org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean
All Implemented Interfaces:
DisposableBean, FactoryBean, InitializingBean

public class ThreadPoolExecutorFactoryBean
extends AbstractFactoryBean

Spring FactoryBean which enables the configuration of ThreadPoolExecutor instances using Spring. Most of this code has been copied from the ThreadPoolTaskExecutor class available in Spring 2.0.

Version:
$Rev$, $Date$
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Field Summary
 
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
 
Constructor Summary
ThreadPoolExecutorFactoryBean()
           
 
Method Summary
protected  Object createInstance()
           
protected  void destroyInstance(Object o)
           
 Class getObjectType()
           
 void setCorePoolSize(int corePoolSize)
          Set the ThreadPoolExecutor's core pool size.
 void setKeepAliveSeconds(int keepAliveSeconds)
          Set the ThreadPoolExecutor's keep alive seconds.
 void setMaxPoolSize(int maxPoolSize)
          Set the ThreadPoolExecutor's maximum pool size.
 void setQueueCapacity(int queueCapacity)
          Set the capacity for the ThreadPoolExecutor's BlockingQueue.
 void setRejectedExecutionHandler(edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
          Set the RejectedExecutionHandler to use for the ThreadPoolExecutor.
 void setThreadFactory(edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory threadFactory)
          Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool.
 
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getObject, isSingleton, setSingleton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPoolExecutorFactoryBean

public ThreadPoolExecutorFactoryBean()
Method Detail

setCorePoolSize

public void setCorePoolSize(int corePoolSize)
Set the ThreadPoolExecutor's core pool size. Default is 1.


setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Set the ThreadPoolExecutor's maximum pool size. Default is Integer.MAX_VALUE.


setKeepAliveSeconds

public void setKeepAliveSeconds(int keepAliveSeconds)
Set the ThreadPoolExecutor's keep alive seconds. Default is 60.


setQueueCapacity

public void setQueueCapacity(int queueCapacity)
Set the capacity for the ThreadPoolExecutor's BlockingQueue. Default is Integer.MAX_VALUE.

Any positive value will lead to a LinkedBlockingQueue instance; any other value will lead to a SynchronousQueue instance.

See Also:
LinkedBlockingQueue, SynchronousQueue

setThreadFactory

public void setThreadFactory(edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory threadFactory)
Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool. Default is the ThreadPoolExecutor's default thread factory.

See Also:
Executors.defaultThreadFactory()

setRejectedExecutionHandler

public void setRejectedExecutionHandler(edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Set the RejectedExecutionHandler to use for the ThreadPoolExecutor. Default is the ThreadPoolExecutor's default abort policy.

See Also:
ThreadPoolExecutor.AbortPolicy

createInstance

protected Object createInstance()
                         throws Exception
Specified by:
createInstance in class AbstractFactoryBean
Throws:
Exception

destroyInstance

protected void destroyInstance(Object o)
                        throws Exception
Overrides:
destroyInstance in class AbstractFactoryBean
Throws:
Exception

getObjectType

public Class getObjectType()


Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.