public class TimerManagerFactoryBean extends TimerManagerAccessor implements org.springframework.beans.factory.FactoryBean<TimerManager>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.Lifecycle
FactoryBean
that retrieves a
CommonJ TimerManager
and exposes it for bean references.
This is the central convenience class for setting up a CommonJ TimerManager in a Spring context.
Allows for registration of ScheduledTimerListeners. This is the main
purpose of this class; the TimerManager itself could also be fetched
from JNDI via JndiObjectFactoryBean
.
In scenarios that just require static registration of tasks at startup,
there is no need to access the TimerManager itself in application code.
Note that the TimerManager uses a TimerListener instance that is shared between repeated executions, in contrast to Quartz which instantiates a new Job for each execution.
ScheduledTimerListener
,
TimerManager
,
TimerListener
Constructor and Description |
---|
TimerManagerFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
destroy()
Cancels all statically registered Timers on shutdown,
and stops the underlying TimerManager (if not shared).
|
TimerManager |
getObject() |
Class<? extends TimerManager> |
getObjectType() |
boolean |
isSingleton() |
void |
setScheduledTimerListeners(ScheduledTimerListener[] scheduledTimerListeners)
Register a list of ScheduledTimerListener objects with the TimerManager
that this FactoryBean creates.
|
getTimerManager, isRunning, obtainTimerManager, setShared, setTimerManager, setTimerManagerName, start, stop
convertJndiName, isResourceRef, lookup, lookup, setResourceRef
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
public void setScheduledTimerListeners(ScheduledTimerListener[] scheduledTimerListeners)
public void afterPropertiesSet() throws NamingException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class TimerManagerAccessor
NamingException
@Nullable public TimerManager getObject()
getObject
in interface org.springframework.beans.factory.FactoryBean<TimerManager>
public Class<? extends TimerManager> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<TimerManager>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<TimerManager>
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
destroy
in class TimerManagerAccessor
Timer.cancel()
,
TimerManager.stop()