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 to null

public interface StartupStep<CONTEXT>
Base interface for startup (and shutdown) steps. Each step implements the startup logic in 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 Details

    • getName

      String getName()
      Returns name for logging purposes
      Returns:
      name for logging purposes
    • startup

      ActorFuture<CONTEXT> startup(CONTEXT context)
      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

      ActorFuture<CONTEXT> shutdown(CONTEXT context)
      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.