public class ThreadPoolExecutorFactoryBean
extends org.springframework.beans.factory.config.AbstractFactoryBean
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.| Constructor and Description |
|---|
ThreadPoolExecutorFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
createInstance() |
protected void |
destroyInstance(java.lang.Object o) |
java.lang.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(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Set the RejectedExecutionHandler to use for the ThreadPoolExecutor.
|
void |
setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool.
|
public void setCorePoolSize(int corePoolSize)
public void setMaxPoolSize(int maxPoolSize)
Integer.MAX_VALUE.public void setKeepAliveSeconds(int keepAliveSeconds)
public void setQueueCapacity(int queueCapacity)
Integer.MAX_VALUE.
Any positive value will lead to a LinkedBlockingQueue instance; any other value will lead to a SynchronousQueue instance.
LinkedBlockingQueue,
SynchronousQueuepublic void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Executors.defaultThreadFactory()public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
ThreadPoolExecutor.AbortPolicyprotected java.lang.Object createInstance()
throws java.lang.Exception
createInstance in class org.springframework.beans.factory.config.AbstractFactoryBeanjava.lang.Exceptionprotected void destroyInstance(java.lang.Object o)
throws java.lang.Exception
destroyInstance in class org.springframework.beans.factory.config.AbstractFactoryBeanjava.lang.Exceptionpublic java.lang.Class getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBeangetObjectType in class org.springframework.beans.factory.config.AbstractFactoryBean