Interface ShutdownManager
public interface ShutdownManager
Interface used by shutdown managers to allow for thread safe
adding and removing of shutdown listeners.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddShutdownListener(ShutdownListener listener) Adds a ShutdownListener to this ShutdownManager with the default priority.voidaddShutdownListener(ShutdownListener listener, ShutdownPriority priority) Adds a ShutdownListener to this ShutdownManager with the supplied priority.booleanFind out whether the shutdown has been triggered.voidremoveShutdownListener(ShutdownListener listener) Removes a ShutdownListener from this ShutdownManager.voidreplaceShutdownListener(ShutdownListener oldListener, ShutdownListener newListener, ShutdownPriority priority) Replaces an existing ShutdownListener with the new ShutdownListener.voidshutdown()Shuts down all the listeners in this ShutdownManager.
-
Method Details
-
addShutdownListener
Adds a ShutdownListener to this ShutdownManager with the default priority.If
shutdown()has already been called, the listener should immediately be invoked.- Parameters:
listener- The listener to be added.
-
addShutdownListener
Adds a ShutdownListener to this ShutdownManager with the supplied priority.If
shutdown()has already been called, the listener should immediately be invoked.- Parameters:
listener- The listener to be added.priority- The priority of the listener when added.
-
replaceShutdownListener
void replaceShutdownListener(ShutdownListener oldListener, ShutdownListener newListener, ShutdownPriority priority) Replaces an existing ShutdownListener with the new ShutdownListener.If
shutdown()has already been called, the new listener should immediately be invoked.- Parameters:
oldListener- To be replaced.newListener- The replacement.priority- Replacement listeners priority.
-
removeShutdownListener
Removes a ShutdownListener from this ShutdownManager.- Parameters:
listener- The listener to be removed.
-
shutdown
void shutdown()Shuts down all the listeners in this ShutdownManager. -
isShutdown
boolean isShutdown()Find out whether the shutdown has been triggered.- Returns:
trueif theshutdown()method has been called.
-