Class ThreadPoolExecutorFactoryBean
- java.lang.Object
-
- org.springframework.beans.factory.config.AbstractFactoryBean
-
- org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.FactoryBean,org.springframework.beans.factory.InitializingBean
public class ThreadPoolExecutorFactoryBean extends org.springframework.beans.factory.config.AbstractFactoryBeanSpringFactoryBeanwhich enables the configuration ofThreadPoolExecutorinstances using Spring. Most of this code has been copied from theThreadPoolTaskExecutorclass available in Spring 2.0.
-
-
Constructor Summary
Constructors Constructor Description ThreadPoolExecutorFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectcreateInstance()protected voiddestroyInstance(java.lang.Object o)java.lang.ClassgetObjectType()voidsetCorePoolSize(int corePoolSize)Set the ThreadPoolExecutor's core pool size.voidsetKeepAliveSeconds(int keepAliveSeconds)Set the ThreadPoolExecutor's keep alive seconds.voidsetMaxPoolSize(int maxPoolSize)Set the ThreadPoolExecutor's maximum pool size.voidsetQueueCapacity(int queueCapacity)Set the capacity for the ThreadPoolExecutor's BlockingQueue.voidsetRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)Set the RejectedExecutionHandler to use for the ThreadPoolExecutor.voidsetThreadFactory(java.util.concurrent.ThreadFactory threadFactory)Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool.
-
-
-
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 isInteger.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 isInteger.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(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(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 java.lang.Object createInstance() throws java.lang.Exception- Specified by:
createInstancein classorg.springframework.beans.factory.config.AbstractFactoryBean- Throws:
java.lang.Exception
-
destroyInstance
protected void destroyInstance(java.lang.Object o) throws java.lang.Exception- Overrides:
destroyInstancein classorg.springframework.beans.factory.config.AbstractFactoryBean- Throws:
java.lang.Exception
-
getObjectType
public java.lang.Class getObjectType()
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean- Specified by:
getObjectTypein classorg.springframework.beans.factory.config.AbstractFactoryBean
-
-