java.lang.Object
dk.cloudcreate.essentials.components.foundation.lifecycle.DefaultLifecycleManager
All Implemented Interfaces:
LifecycleManager, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public final class DefaultLifecycleManager extends Object implements org.springframework.context.SmartLifecycle, LifecycleManager, org.springframework.context.ApplicationContextAware
Default LifecycleManager that integrate with Spring to ensure that ApplicationContext Beans that registered Beans implementing the Lifecycle interface are started and stopped
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultLifecycleManager(boolean isStartLifecycles)
     
    DefaultLifecycleManager(Consumer<org.springframework.context.ApplicationContext> contextRefreshedEventConsumer, boolean isStartLifecycles)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     
    void
     
    void
     

    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

    isAutoStartup, stop
  • Field Details

    • log

      public static final org.slf4j.Logger log
  • Constructor Details

    • DefaultLifecycleManager

      public DefaultLifecycleManager(Consumer<org.springframework.context.ApplicationContext> contextRefreshedEventConsumer, boolean isStartLifecycles)
      Parameters:
      contextRefreshedEventConsumer - callback that will be called after all Lifecycle Beans Lifecycle.start() has been called
      isStartLifecycles - determines if lifecycle beans should be started automatically
    • DefaultLifecycleManager

      public DefaultLifecycleManager(boolean isStartLifecycles)
      Parameters:
      isStartLifecycles - determines if lifecycle beans should be started automatically
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • stop

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

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

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • getPhase

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