public class DefaultLifecycleProcessor extends java.lang.Object implements LifecycleProcessor, ApplicationContextAware
LifecycleProcessor strategy.| 构造器和说明 |
|---|
DefaultLifecycleProcessor() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected java.util.Map<java.lang.String,Lifecycle> |
getLifecycleBeans()
Retrieve all applicable Lifecycle beans: all singletons that have already been created,
as well as all SmartLifecycle beans (even if they are marked as lazy-init).
|
protected int |
getPhase(Lifecycle bean)
Determine the lifecycle phase of the given bean.
|
boolean |
isRunning()
Check whether this component is currently running.
|
void |
onClose()
Notification of context close phase, e.g. for auto-stopping components.
|
void |
onRefresh()
Notification of context refresh, e.g. for auto-starting components.
|
void |
setApplicationContext(BaseApplicationContext beanFactory)
Set the ApplicationContext that this object runs in.
|
void |
setTimeoutPerShutdownPhase(long timeoutPerShutdownPhase)
Specify the maximum time allotted in milliseconds for the shutdown of
any phase (group of SmartLifecycle beans with the same 'phase' value).
|
void |
start()
Start all registered beans that implement Lifecycle and are
not already running.
|
void |
stop()
Stop all registered beans that implement Lifecycle and are
currently running.
|
public void setTimeoutPerShutdownPhase(long timeoutPerShutdownPhase)
public void setApplicationContext(BaseApplicationContext beanFactory)
ApplicationContextAwareInvoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.frameworkset.util.io.ResourceLoader),
ApplicationEventPublisherAware#setApplicationEventPublisher and
MessageSourceAware, if applicable.
setApplicationContext 在接口中 ApplicationContextAwarebeanFactory - the ApplicationContext object to be used by this objectpublic void start()
start 在接口中 LifecycleSmartLifecycle.isAutoStartup()public void stop()
stop 在接口中 LifecycleSmartLifecycle.stop(Runnable),
DisposableBean.destroy()public void onRefresh()
LifecycleProcessoronRefresh 在接口中 LifecycleProcessorpublic void onClose()
LifecycleProcessoronClose 在接口中 LifecycleProcessorpublic boolean isRunning()
LifecycleIn the case of a container, this will return true only if all
components that apply are currently running.
protected java.util.Map<java.lang.String,Lifecycle> getLifecycleBeans()
protected int getPhase(Lifecycle bean)
The default implementation checks for the Phased interface.
Can be overridden to apply other/further policies.
bean - the bean to introspectPhased,
SmartLifecycle