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 TypeMethodDescriptionvoid
addShutdownListener
(ShutdownListener listener) Adds a ShutdownListener to this ShutdownManager with the default priority.void
addShutdownListener
(ShutdownListener listener, ShutdownPriority priority) Adds a ShutdownListener to this ShutdownManager with the supplied priority.boolean
Find out whether the shutdown has been triggered.void
removeShutdownListener
(ShutdownListener listener) Removes a ShutdownListener from this ShutdownManager.void
replaceShutdownListener
(ShutdownListener oldListener, ShutdownListener newListener, ShutdownPriority priority) Replaces an existing ShutdownListener with the new ShutdownListener.void
shutdown()
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:
true
if theshutdown()
method has been called.
-