类 DefaultLifecycleProcessor
java.lang.Object
cn.taketoday.context.support.DefaultLifecycleProcessor
- 所有已实现的接口:
Aware,BeanFactoryAware,Lifecycle,LifecycleProcessor
public class DefaultLifecycleProcessor
extends Object
implements LifecycleProcessor, BeanFactoryAware
Default implementation of the
LifecycleProcessor strategy.- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Juergen Hoeller
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明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 intDetermine the lifecycle phase of the given bean.booleanCheck whether this component is currently running.voidonClose()Notification of context close phase, e.g. for auto-stopping components.voidNotification of context refresh, e.g. for auto-starting components.voidsetBeanFactory(BeanFactory beanFactory) voidsetTimeoutPerShutdownPhase(long timeoutPerShutdownPhase) Specify the maximum time allotted in milliseconds for the shutdown of any phase (group of SmartLifecycle beans with the same 'phase' value).voidstart()Start all registered beans that implementLifecycleand are not already running.voidstop()Stop all registered beans that implementLifecycleand are currently running.
-
构造器详细资料
-
DefaultLifecycleProcessor
public DefaultLifecycleProcessor()
-
-
方法详细资料
-
setTimeoutPerShutdownPhase
public 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).The default value is 30 seconds.
-
setBeanFactory
- 指定者:
setBeanFactory在接口中BeanFactoryAware
-
start
public void start()Start all registered beans that implementLifecycleand are not already running. Any bean that implementsSmartLifecyclewill be started within its 'phase', and all phases will be ordered from lowest to highest value. All beans that do not implementSmartLifecyclewill be started in the default phase 0. A bean declared as a dependency of another bean will be started before the dependent bean regardless of the declared phase. -
stop
public void stop()Stop all registered beans that implementLifecycleand are currently running. Any bean that implementsSmartLifecyclewill be stopped within its 'phase', and all phases will be ordered from highest to lowest value. All beans that do not implementSmartLifecyclewill be stopped in the default phase 0. A bean declared as dependent on another bean will be stopped before the dependency bean regardless of the declared phase. -
onRefresh
public void onRefresh()从接口复制的说明:LifecycleProcessorNotification of context refresh, e.g. for auto-starting components.- 指定者:
onRefresh在接口中LifecycleProcessor
-
onClose
public void onClose()从接口复制的说明:LifecycleProcessorNotification of context close phase, e.g. for auto-stopping components.- 指定者:
onClose在接口中LifecycleProcessor
-
isRunning
public boolean isRunning()从接口复制的说明:LifecycleCheck whether this component is currently running.In the case of a container, this will return
trueonly if all components that apply are currently running. -
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).- 返回:
- the Map of applicable beans, with bean names as keys and bean instances as values
-
getPhase
Determine the lifecycle phase of the given bean.The default implementation checks for the
Phasedinterface, using a default of 0 otherwise. Can be overridden to apply other/further policies.- 参数:
bean- the bean to introspect- 返回:
- the phase (an integer value)
- 另请参阅:
-