Package com.codingchili.core.context
Class ShutdownListener
java.lang.Object
com.codingchili.core.context.ShutdownListener
Allows a subscriber to receive shutdown events.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
Removes all shutdown listeners.static io.vertx.core.Future<Void>
publish(CoreContext core)
Emits a shutdown event to all subscribers.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.static void
unsubscribe(Function<Optional<CoreContext>,io.vertx.core.Future<Void>> listener)
Unsubscribe from all shutdown events.
-
Constructor Details
-
ShutdownListener
public ShutdownListener()
-
-
Method Details
-
subscribe
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
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.
-