|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.util.ThreadPoolExecutorFactoryBean
public class ThreadPoolExecutorFactoryBean
Factory for ThreadPoolExecutor
instances,
which cannot easily be constructed using constructor injection. This instance
also allows the setting of the thread-specific properties that would otherwise
require setting a ThreadFactory
.
This factory provides the a singleton instance of the pool.
Defaults are:
corePoolSize
:
20maximumPoolSize
:
Equal to the ThreadPoolExecutorFactoryBean.setCorePoolSize(int)
at the time of instance creationkeepAliveTime
:
90 secondsthreadPriority
:
5 (NORM)threadDaemon
:
trueworkQueueSize
:
-1 or less (No upper bound)ThreadPoolExecutor.CallerRunsPolicy
Constructor Summary | |
---|---|
ThreadPoolExecutorFactoryBean()
Constructor setting default properties: |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
java.lang.Object |
getObject()
|
java.lang.Class |
getObjectType()
|
java.lang.String |
getPoolName()
|
boolean |
isSingleton()
|
void |
setCorePoolSize(int corePoolSize)
The number of threads to keep in the pool, even if idle. |
void |
setKeepAliveTime(int keepAliveTime)
The time (in seconds) to keep non-core idle threads in the pool |
void |
setMaximumPoolSize(int maximumPoolSize)
The maximum number of threads to keep in the pool |
void |
setPoolName(java.lang.String poolName)
|
void |
setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
The optional handler for when tasks cannot be submitted to the queue. |
void |
setThreadDaemon(boolean threadDaemon)
Set whether the threads run as daemon threads or not. |
void |
setThreadPriority(int threadPriority)
The priority that all threads must have on the scale of 1 to 10, where 1 has the lowest priority and 10 has the highest priority. |
void |
setWorkQueueSize(int workQueueSize)
The maximum number of queued work instances to keep before blocking against further adds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadPoolExecutorFactoryBean()
Method Detail |
---|
public void setCorePoolSize(int corePoolSize)
corePoolSize
- core thread countpublic void setMaximumPoolSize(int maximumPoolSize)
maximumPoolSize
- the maximum number of threads in the poolpublic void setKeepAliveTime(int keepAliveTime)
keepAliveTime
- time to stay idle in secondspublic void setThreadPriority(int threadPriority)
threadPriority
- the thread prioritypublic void setThreadDaemon(boolean threadDaemon)
threadDaemon
- true to run as daemonpublic void setWorkQueueSize(int workQueueSize)
size
- the queue size before blocks, or -1 default
to indicate no upper boundpublic void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
CallerRunsPolicy
.
rejectedExecutionHandler
- the handler to usepublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean
public java.lang.Object getObject() throws java.lang.Exception
getObject
in interface org.springframework.beans.factory.FactoryBean
instance
.
java.lang.Exception
public java.lang.Class getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean
ThreadPoolExecutor
public java.lang.String getPoolName()
public void setPoolName(java.lang.String poolName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |