Will resolve asynchronously after all startup actions are done.
Will resolve asynchronously after all shutdown actions are done.
Create a new de.sebbraun.lifecycle.simple.LifecycleComponent that will be managed by this Manager.
Create a new de.sebbraun.lifecycle.simple.LifecycleComponent that will be managed by this Manager.
val lifeCycleManager = new LifecycleManager() val component = lifeCycleManager.component(<NAME>) { _.depend(<DEPENDENCY1>, <DEPENDENCY2>...) .toStart(<ACTION>) .toStopAsync(implicit ec => <ASYNC-ACTION>) }
The name of the LifecycleComponent to create.
A function that specified dependencies and actions for this component. Only functions that specify both a start action and a stop action are accepted.
A representation of the new component that may be used to express dependencies in other components.
Triggers the startup of the LifecycleManager and of all the LifecycleComponents it manages.
Triggers the startup of the LifecycleManager and of all the LifecycleComponents it manages.
A user-supplied scala.concurrent.ExecutionContext in which all startup actions will run
A Future that resolves when all components have started up. The value of the future will be an appropriate LifecycleComponent.StartupResult for every managed component.
Triggers the startup of the LifecycleManager and waits for all startup actions to complete.
Triggers the startup of the LifecycleManager and waits for all startup actions to complete.
How long to wait for the startup to finish.
A user-supplied scala.concurrent.ExecutionContext in which all startup actions will run
An appropriate LifecycleComponent.StartupResult for every managed component.
LifecycleManager.start
Triggers the shutdown of the LifecycleManager and all of the LifecycleComponents it manages.
Triggers the shutdown of the LifecycleManager and all of the LifecycleComponents it manages.
A user-supplied scala.concurrent.ExecutionContext in which all shutdown actions will run
An appropriate LifecycleComponent.StopResult for every managed component.
Triggers the shutdown of the LifecycleManager and wait for all shutdown actions to finish.
Triggers the shutdown of the LifecycleManager and wait for all shutdown actions to finish.
How long to wait for shutdown to finish.
A user-supplied scala.concurrent.ExecutionContext in which all shutdown actions will run
An appropriate LifecycleComponent.StopResult for every managed component.
LifecycleManager.stop
Manages the startup and shutdown process of a complex system.
A
LifecycleManagermanages instances of LifecycleComponent. The lifecycle defined by this class is very simple and not sophisticated at all:Usage example
should output:
Rules
The following rules apply: