Class AppShutdown

java.lang.Object
com.arpnetworking.metrics.mad.AppShutdown
All Implemented Interfaces:
LifecycleRegistration

public class AppShutdown extends Object implements LifecycleRegistration
Assists Guice-instantiated classes in shutting down.
Author:
Brandon Arp (brandon dot arp at inscopemetrics dot io)
  • Constructor Details

    • AppShutdown

      public AppShutdown()
  • Method Details

    • registerShutdown

      public void registerShutdown(Supplier<CompletionStage<Void>> callback)
      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 interface LifecycleRegistration
      Parameters:
      callback - The callback to register
    • shutdown

      public void shutdown()
      Executes all of the registered shutdown hooks and waits for them to complete.