Class LifecycleObjectSupport
java.lang.Object
org.springframework.statemachine.support.LifecycleObjectSupport
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,StateMachineReactiveLifecycle
- Direct Known Subclasses:
AbstractPersistStateMachineHandler,AbstractState,AbstractStateMachineFactory,DistributedStateMachine,ReactiveStateMachineExecutor,StateMachineEnsembleObjectSupport,StateMachineObjectSupport,TimerTrigger
public abstract class LifecycleObjectSupport
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.SmartLifecycle, org.springframework.beans.factory.BeanFactoryAware, StateMachineReactiveLifecycle
Convenient base class for object which needs spring task scheduler, task
executor and life cycle handling.
- Author:
- Janne Valkealahti
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal voiddestroy()protected voidSubclasses may implement this for destroy logic.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for post start logic.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for post stop logic.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for pre start logic.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for pre stop logic.protected final org.springframework.beans.factory.BeanFactoryGets theBeanFactoryfor this instance.final intgetPhase()final booleanbooleanprotected voidonInit()Subclasses may implement this for initialization logic.voidsetAutoStartup(boolean autoStartup) Sets the auto startup.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetPhase(int phase) Sets the phase.voidstart()reactor.core.publisher.Mono<Void>Starts component reactively.voidstop()reactor.core.publisher.Mono<Void>Stops component reactively.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Constructor Details
-
LifecycleObjectSupport
public LifecycleObjectSupport()
-
-
Method Details
-
afterPropertiesSet
public final void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException
-
isAutoStartup
public final boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
getPhase
public final int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
startReactively
Description copied from interface:StateMachineReactiveLifecycleStarts component reactively.- Specified by:
startReactivelyin interfaceStateMachineReactiveLifecycle- Returns:
- the mono for completion
-
stopReactively
Description copied from interface:StateMachineReactiveLifecycleStops component reactively.- Specified by:
stopReactivelyin interfaceStateMachineReactiveLifecycle- Returns:
- the mono for completion
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) Sets the auto startup.- Parameters:
autoStartup- the new auto startup- See Also:
-
SmartLifecycle
-
setPhase
public void setPhase(int phase) Sets the phase.- Parameters:
phase- the new phase- See Also:
-
SmartLifecycle
-
getBeanFactory
protected final org.springframework.beans.factory.BeanFactory getBeanFactory()Gets theBeanFactoryfor this instance.- Returns:
- the bean factory.
-
onInit
Subclasses may implement this for initialization logic. Called during theInitializingBeanphase.- Throws:
Exception- exception
-
doDestroy
protected void doDestroy()Subclasses may implement this for destroy logic. -
doPreStartReactively
Subclasses may implement this for pre start logic.- Returns:
- the mono for completion
-
doPreStopReactively
Subclasses may implement this for pre stop logic.- Returns:
- the mono for completion
-
doPostStartReactively
Subclasses may implement this for post start logic.- Returns:
- the mono for completion
-
doPostStopReactively
Subclasses may implement this for post stop logic.- Returns:
- the mono for completion
-