|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.util.CustomizableThreadCreator
org.springframework.scheduling.concurrent.CustomizableThreadFactory
org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
public abstract class ExecutorConfigurationSupport
Base class for classes that are setting up a
java.util.concurrent.ExecutorService
(typically a ThreadPoolExecutor
).
Defines common configuration settings and common lifecycle handling.
ExecutorService
,
Executors
,
ThreadPoolExecutor
,
Serialized FormField Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
---|---|
ExecutorConfigurationSupport()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Calls initialize() after the container applied all property values. |
void |
destroy()
Calls shutdown when the BeanFactory destroys
the task executor instance. |
void |
initialize()
Set up the ExecutorService. |
protected abstract java.util.concurrent.ExecutorService |
initializeExecutor(java.util.concurrent.ThreadFactory threadFactory,
java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Create the target ExecutorService instance. |
void |
setBeanName(java.lang.String name)
|
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. |
void |
setThreadNamePrefix(java.lang.String threadNamePrefix)
|
void |
setWaitForTasksToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)
Set whether to wait for scheduled tasks to complete on shutdown. |
void |
shutdown()
Perform a shutdown on the ThreadPoolExecutor. |
Methods inherited from class org.springframework.scheduling.concurrent.CustomizableThreadFactory |
---|
newThread |
Methods inherited from class org.springframework.util.CustomizableThreadCreator |
---|
createThread, getDefaultThreadNamePrefix, getThreadGroup, getThreadNamePrefix, getThreadPriority, isDaemon, nextThreadName, setDaemon, setThreadGroup, setThreadGroupName, setThreadPriority |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public ExecutorConfigurationSupport()
Method Detail |
---|
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Executors.defaultThreadFactory()
public void setThreadNamePrefix(java.lang.String threadNamePrefix)
setThreadNamePrefix
in class org.springframework.util.CustomizableThreadCreator
public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
ThreadPoolExecutor.AbortPolicy
public void setWaitForTasksToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown)
Default is "false". Switch this to "true" if you prefer fully completed tasks at the expense of a longer shutdown phase.
ExecutorService.shutdown()
,
ExecutorService.shutdownNow()
public void setBeanName(java.lang.String name)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public void afterPropertiesSet()
initialize()
after the container applied all property values.
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
initialize()
public void initialize()
protected abstract java.util.concurrent.ExecutorService initializeExecutor(java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
ExecutorService
instance.
Called by afterPropertiesSet
.
threadFactory
- the ThreadFactory to userejectedExecutionHandler
- the RejectedExecutionHandler to use
afterPropertiesSet()
public void destroy()
shutdown
when the BeanFactory destroys
the task executor instance.
destroy
in interface org.springframework.beans.factory.DisposableBean
shutdown()
public void shutdown()
ExecutorService.shutdown()
|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |