Class ShutdownNotifierComponent

    • Field Detail

      • monitor

        private final java.lang.Object monitor
        Monitor for shutdown listeners and shutdownCause
      • shutdownListeners

        private final java.util.List<ShutdownListener> shutdownListeners
        List of all shutdown listeners associated with the component
      • shutdownCause

        private volatile ShutdownSignalException shutdownCause
        When this value is null, the component is in an "open" state. When non-null, the component is in "closed" state, and this value indicates the circumstances of the shutdown.
    • Constructor Detail

      • ShutdownNotifierComponent

        public ShutdownNotifierComponent()
    • Method Detail

      • isOpen

        public boolean isOpen()
        Description copied from interface: ShutdownNotifier
        Determine whether the component is currently open. Will return false if we are currently closing. Checking this method should be only for information, because of the race conditions - state can change after the call. Instead just execute and try to catch ShutdownSignalException and IOException
        Specified by:
        isOpen in interface ShutdownNotifier
        Returns:
        true when component is open, false otherwise
      • setShutdownCauseIfOpen

        public boolean setShutdownCauseIfOpen​(ShutdownSignalException sse)
        Internal: this is the means of registering shutdown.
        Parameters:
        sse - the reason for the shutdown
        Returns:
        true if the component is open; false otherwise.