Package dev.voidframework.core.lifecycle
Class LifeCycleManager
java.lang.Object
dev.voidframework.core.lifecycle.LifeCycleManager
Life cycle manager takes care of executing the various hooks defined by the use of
the
LifeCycleStart and LifeCycleStop
annotations.-
Constructor Summary
ConstructorsConstructorDescriptionLifeCycleManager(com.typesafe.config.Config configuration) Build a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidregisterStart(Class<?> classType, Method method, int priority) Register a "START" method.voidregisterStop(Class<?> classType, Method method, int priority, String gracefulStopTimeoutConfigKey) Register a "STOP" method.voidsetInjector(com.google.inject.Injector injector) Sets the injector.voidstartAll()Invoke all registered "START" methods.voidstopAll()Invoke all registered "STOP" methods.
-
Constructor Details
-
LifeCycleManager
public LifeCycleManager(com.typesafe.config.Config configuration) Build a new instance.- Parameters:
configuration- The application configuration
-
-
Method Details
-
setInjector
@Inject public void setInjector(com.google.inject.Injector injector) Sets the injector.- Parameters:
injector- The injector instance
-
registerStart
Register a "START" method.- Parameters:
classType- The class type where is located the method to invokemethod- The method to invokepriority- The priority
-
registerStop
public void registerStop(Class<?> classType, Method method, int priority, String gracefulStopTimeoutConfigKey) Register a "STOP" method.- Parameters:
classType- The class type where is located the method to invokemethod- The method to invokepriority- The prioritygracefulStopTimeoutConfigKey- The graceful stop timeout configuration key
-
startAll
public void startAll()Invoke all registered "START" methods. -
stopAll
public void stopAll()Invoke all registered "STOP" methods.
-