Class ShutdownListener

java.lang.Object
com.codingchili.core.context.ShutdownListener

public class ShutdownListener extends Object
Allows a subscriber to receive shutdown events.
  • Constructor Details

    • ShutdownListener

      public ShutdownListener()
  • Method Details

    • subscribe

      public static void subscribe(Function<Optional<CoreContext>,​io.vertx.core.Future<Void>> runnable)
      Adds a shutdown listener that is called right before a context is closed.
      Parameters:
      runnable - listener.
    • unsubscribe

      public static void unsubscribe(Function<Optional<CoreContext>,​io.vertx.core.Future<Void>> listener)
      Unsubscribe from all shutdown events.
      Parameters:
      listener - the listener to be removed.
    • publish

      public static io.vertx.core.Future<Void> publish(CoreContext core)
      Emits a shutdown event to all subscribers.
      Parameters:
      core - the context that was shut down.
      Returns:
      future completed when all handlers succeeded or failed.
    • clear

      public static void clear()
      Removes all shutdown listeners.