Interface ShutdownNotifier.ShutdownRequestListener

  • Enclosing class:
    ShutdownNotifier
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public static interface ShutdownNotifier.ShutdownRequestListener
    • Method Detail

      • shutdownRequested

        void shutdownRequested​(String reason)
        This method is called on registered listeners the first time ShutdownManager.requestShutdown(String) on the associated ShutdownManager instance is called.

        Implementations of this method should be reasonably quick and never throw an exception.

        Note that it is usually not necessary to use a listener when all you want to do in this method is to set some boolean flag. Instead, just call ShutdownNotifier.shouldShutdown() whenever you would check the flag (this is similarly cheap and thread-safe).

        Parameters:
        reason - A non-null human-readable string that tells the user why a shutdown was requested.