类 TimerManagerAccessor
- java.lang.Object
- org.springframework.jndi.JndiAccessor
- org.springframework.jndi.JndiLocatorSupport
- org.springframework.scheduling.commonj.TimerManagerAccessor
- 所有已实现的接口:
DisposableBean
,InitializingBean
,Lifecycle
public abstract class TimerManagerAccessor extends JndiLocatorSupport implements InitializingBean, DisposableBean, Lifecycle
Base class for classes that are accessing a CommonJTimerManager
Defines common configuration settings and common lifecycle handling.- 从以下版本开始:
- 3.0
- 作者:
- Juergen Hoeller
- 另请参阅:
TimerManager
字段概要
从类继承的字段 org.springframework.jndi.JndiLocatorSupport
CONTAINER_PREFIX
从类继承的字段 org.springframework.jndi.JndiAccessor
logger
构造器概要
构造器 构造器 说明 TimerManagerAccessor()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.void
destroy()
Stops the underlying TimerManager (if not shared).protected TimerManager
getTimerManager()
boolean
isRunning()
Considers the underlying TimerManager as running if it is neither suspending nor stopping.void
setShared(boolean shared)
Specify whether the TimerManager obtained by this FactoryBean is a shared instance ("true") or an independent instance ("false").void
setTimerManager(TimerManager timerManager)
Specify the CommonJ TimerManager to delegate to.void
setTimerManagerName(String timerManagerName)
Set the JNDI name of the CommonJ TimerManager.void
start()
Resumes the underlying TimerManager (if not shared).void
stop()
Suspends the underlying TimerManager (if not shared).从类继承的方法 org.springframework.jndi.JndiLocatorSupport
convertJndiName, isResourceRef, lookup, lookup, setResourceRef
从类继承的方法 org.springframework.jndi.JndiAccessor
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
构造器详细资料
TimerManagerAccessor
public TimerManagerAccessor()
方法详细资料
setTimerManager
public void setTimerManager(TimerManager timerManager)
Specify the CommonJ TimerManager to delegate to.Note that the given TimerManager's lifecycle will be managed by this FactoryBean.
Alternatively (and typically), you can specify the JNDI name of the target TimerManager.
setTimerManagerName
public void setTimerManagerName(String timerManagerName)
Set the JNDI name of the CommonJ TimerManager.This can either be a fully qualified JNDI name, or the JNDI name relative to the current environment naming context if "resourceRef" is set to "true".
setShared
public void setShared(boolean shared)
Specify whether the TimerManager obtained by this FactoryBean is a shared instance ("true") or an independent instance ("false"). The lifecycle of the former is supposed to be managed by the application server, while the lifecycle of the latter is up to the application.Default is "false", i.e. managing an independent TimerManager instance. This is what the CommonJ specification suggests that application servers are supposed to offer via JNDI lookups, typically declared as a
resource-ref
of typecommonj.timers.TimerManager
inweb.xml
, withres-sharing-scope
set to 'Unshareable'.Switch this flag to "true" if you are obtaining a shared TimerManager, typically through specifying the JNDI location of a TimerManager that has been explicitly declared as 'Shareable'. Note that WebLogic's cluster-aware Job Scheduler is a shared TimerManager too.
The sole difference between this FactoryBean being in shared or non-shared mode is that it will only attempt to suspend / resume / stop the underlying TimerManager in case of an independent (non-shared) instance. This only affects the
Lifecycle
support as well as application context shutdown.- 另请参阅:
stop()
,start()
,destroy()
,TimerManager
afterPropertiesSet
public void afterPropertiesSet() throws NamingException
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
- 抛出:
NamingException
getTimerManager
protected final TimerManager getTimerManager()
start
public void start()
Resumes the underlying TimerManager (if not shared).- 指定者:
start
在接口中Lifecycle
- 另请参阅:
TimerManager.resume()
stop
public void stop()
Suspends the underlying TimerManager (if not shared).- 指定者:
stop
在接口中Lifecycle
- 另请参阅:
TimerManager.suspend()
isRunning
public boolean isRunning()
Considers the underlying TimerManager as running if it is neither suspending nor stopping.- 指定者:
isRunning
在接口中Lifecycle
- 返回:
- whether the component is currently running
- 另请参阅:
TimerManager.isSuspending()
,TimerManager.isStopping()
destroy
public void destroy()
Stops the underlying TimerManager (if not shared).- 指定者:
destroy
在接口中DisposableBean
- 另请参阅:
TimerManager.stop()