Package play.inject

Interface ApplicationLifecycle

All Known Implementing Classes:
DelegateApplicationLifecycle

public interface ApplicationLifecycle
Application lifecycle register.

This is used to hook into Play lifecycle events, specifically, when Play is stopped.

Stop hooks are executed when the application is shutdown, in reverse from when they were registered.

To use this, declare a dependency on ApplicationLifecycle, and then register the stop hook when the component is started.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addStopHook(Callable<? extends CompletionStage<?>> hook)
    Add a stop hook to be called when the application stops.
    play.api.inject.ApplicationLifecycle
     
  • Method Details

    • addStopHook

      void addStopHook(Callable<? extends CompletionStage<?>> hook)
      Add a stop hook to be called when the application stops.

      The stop hook should redeem the returned future when it is finished shutting down. It is acceptable to stop immediately and return a successful future.

      Parameters:
      hook - the stop hook.
    • asScala

      play.api.inject.ApplicationLifecycle asScala()
      Returns:
      The Scala version for this Application Lifecycle.