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.
  • Constructor Details

    • LifecycleObjectSupport

      public LifecycleObjectSupport()
  • Method Details

    • afterPropertiesSet

      public final void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • destroy

      public final void destroy() throws Exception
      Specified by:
      destroy in interface org.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 interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • isAutoStartup

      public final boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • getPhase

      public final int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • startReactively

      public reactor.core.publisher.Mono<Void> startReactively()
      Description copied from interface: StateMachineReactiveLifecycle
      Starts component reactively.
      Specified by:
      startReactively in interface StateMachineReactiveLifecycle
      Returns:
      the mono for completion
    • stopReactively

      public reactor.core.publisher.Mono<Void> stopReactively()
      Description copied from interface: StateMachineReactiveLifecycle
      Stops component reactively.
      Specified by:
      stopReactively in interface StateMachineReactiveLifecycle
      Returns:
      the mono for completion
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.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 the BeanFactory for this instance.
      Returns:
      the bean factory.
    • onInit

      protected void onInit() throws Exception
      Subclasses may implement this for initialization logic. Called during the InitializingBean phase.
      Throws:
      Exception - exception
    • doDestroy

      protected void doDestroy()
      Subclasses may implement this for destroy logic.
    • doPreStartReactively

      protected reactor.core.publisher.Mono<Void> doPreStartReactively()
      Subclasses may implement this for pre start logic.
      Returns:
      the mono for completion
    • doPreStopReactively

      protected reactor.core.publisher.Mono<Void> doPreStopReactively()
      Subclasses may implement this for pre stop logic.
      Returns:
      the mono for completion
    • doPostStartReactively

      protected reactor.core.publisher.Mono<Void> doPostStartReactively()
      Subclasses may implement this for post start logic.
      Returns:
      the mono for completion
    • doPostStopReactively

      protected reactor.core.publisher.Mono<Void> doPostStopReactively()
      Subclasses may implement this for post stop logic.
      Returns:
      the mono for completion