Class DefaultLifecycleManager
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
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLifecycleManager(boolean isStartLifecycles) DefaultLifecycleManager(Consumer<org.springframework.context.ApplicationContext> contextRefreshedEventConsumer, boolean isStartLifecycles) -
Method Summary
Modifier and TypeMethodDescriptionintgetPhase()booleanvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidstart()voidstop()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
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 allLifecycleBeansLifecycle.start()has been calledisStartLifecycles- 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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-