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.
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
final void
destroy()
protected void
Subclasses 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.BeanFactory
Gets theBeanFactory
for this instance.final int
getPhase()
final boolean
boolean
protected void
onInit()
Subclasses may implement this for initialization logic.void
setAutoStartup
(boolean autoStartup) Sets the auto startup.void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) void
setPhase
(int phase) Sets the phase.void
start()
reactor.core.publisher.Mono<Void>
Starts component reactively.void
stop()
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, wait
Methods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Constructor Details
-
LifecycleObjectSupport
public LifecycleObjectSupport()
-
-
Method Details
-
afterPropertiesSet
public final void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
isAutoStartup
public final boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceorg.springframework.context.SmartLifecycle
-
getPhase
public final int getPhase()- Specified by:
getPhase
in interfaceorg.springframework.context.Phased
- Specified by:
getPhase
in interfaceorg.springframework.context.SmartLifecycle
-
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
startReactively
Description copied from interface:StateMachineReactiveLifecycle
Starts component reactively.- Specified by:
startReactively
in interfaceStateMachineReactiveLifecycle
- Returns:
- the mono for completion
-
stopReactively
Description copied from interface:StateMachineReactiveLifecycle
Stops component reactively.- Specified by:
stopReactively
in interfaceStateMachineReactiveLifecycle
- Returns:
- the mono for completion
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in 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 theBeanFactory
for this instance.- Returns:
- the bean factory.
-
onInit
Subclasses may implement this for initialization logic. Called during theInitializingBean
phase.- 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
-