public class ThreadPoolExecutorFactoryBean
extends 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.构造器和说明 |
---|
ThreadPoolExecutorFactoryBean() |
限定符和类型 | 方法和说明 |
---|---|
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
,
SynchronousQueue
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Executors.defaultThreadFactory()
public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
ThreadPoolExecutor.AbortPolicy
protected java.lang.Object createInstance() throws java.lang.Exception
java.lang.Exception
protected void destroyInstance(java.lang.Object o) throws java.lang.Exception
java.lang.Exception
public java.lang.Class getObjectType()