Package com.arpnetworking.metrics.mad
Class AppShutdown
java.lang.Object
com.arpnetworking.metrics.mad.AppShutdown
- All Implemented Interfaces:
LifecycleRegistration
Assists Guice-instantiated classes in shutting down.
- Author:
- Brandon Arp (brandon dot arp at inscopemetrics dot io)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
registerShutdown
(Supplier<CompletionStage<Void>> callback) Registers a method to be called when the application is shutting down.void
shutdown()
Executes all of the registered shutdown hooks and waits for them to complete.
-
Constructor Details
-
AppShutdown
public AppShutdown()
-
-
Method Details
-
registerShutdown
Registers a method to be called when the application is shutting down. The shutdown will wait for all CompletionStages to complete before shutting down.- Specified by:
registerShutdown
in interfaceLifecycleRegistration
- Parameters:
callback
- The callback to register
-
shutdown
public void shutdown()Executes all of the registered shutdown hooks and waits for them to complete.
-