Interface StartupStep<CONTEXT>
- Type Parameters:
CONTEXT- context object for the startup and shutdown steps. During startup this context is used to collect the resources created during startup; during shutdown it is used to set resources that have been shut down tonull
public interface StartupStep<CONTEXT>
Base interface for startup (and shutdown) steps. Each step implements the startup logic in
Typically, a startup step will create resources and call setters on the context object, whereas a shutdown step will shutdown resources and remove them from the context by setting them to
Contract:
startup(...), as well as, the corresponding shutdown logic in shutdown(...). Both
methods take a context object as argument and return a future of the same context object.Typically, a startup step will create resources and call setters on the context object, whereas a shutdown step will shutdown resources and remove them from the context by setting them to
null. Contract:
- Shutdown will never be called before startup
- Startup will be called at most once
- Shutdown may be called more than once with the expectation that the first call will trigger the shutdown and any subsequent calls shall do nothing
- Shutdown will not be called while startup is running
- Implementation classes can assume that methods of this interface are never called concurrently
-
Method Summary
Modifier and TypeMethodDescriptiongetName()Returns name for logging purposesExecutes the shutdown logicExecutes the startup logic
-
Method Details
-
getName
String getName()Returns name for logging purposes- Returns:
- name for logging purposes
-
startup
Executes the startup logic- Parameters:
context- the startup context at the start of this step- Returns:
- future with startup context at the end of this step
-
shutdown
Executes the shutdown logic- Parameters:
context- the shutdown context at the start of this step- Returns:
- future with the shutdown context at the end of this step.
-