public interface ShutdownManager
| Modifier and Type | Method and Description |
|---|---|
void |
register(StoppableService service)
Registers a service to be notified when the system shuts down
The ShutdownManager will hold a strong reference to this object, preventing it from being garbage collected until shutdown. |
void |
shutdown()
Request that all registered services perform an orderly shutdown.
|
void register(StoppableService service)
service - the service to register (must not be null)java.lang.IllegalArgumentException - if the service provided is null, or if this ShutdownManager has already been shutdownvoid shutdown()
StoppableService.shutdown() method on each registered service in the
reverse registration order (that is, the most recently registered service becomes the first to be shutdown).
Services are given an unlimited amount of time to complete their shutdown (although taking a long time to shutdown is not
advisable - a user may decide the service has crashed and kill the
process).
The shutdown method returns when the shutdown method on each of the StoppableServices has been called and has
returned (whether normally or by throwing an exception)Copyright © 2014. All Rights Reserved.