Class ShutdownNotifierComponent

All Implemented Interfaces:
Direct Known Subclasses:
AMQChannel, AMQConnection

public class ShutdownNotifierComponent extends Object implements ShutdownNotifier
A class that manages ShutdownListeners and remembers the reason for a shutdown. Both Channels and Connections have shutdown listeners.
  • Constructor Details

    • ShutdownNotifierComponent

      public ShutdownNotifierComponent()
  • Method Details

    • addShutdownListener

      public void addShutdownListener(ShutdownListener listener)
      Description copied from interface: ShutdownNotifier
      Add shutdown listener. If the component is already closed, handler is fired immediately
      Specified by:
      addShutdownListener in interface ShutdownNotifier
      listener - ShutdownListener to the component
    • getCloseReason

      public ShutdownSignalException getCloseReason()
      Description copied from interface: ShutdownNotifier
      Get the shutdown reason object
      Specified by:
      getCloseReason in interface ShutdownNotifier
      ShutdownSignalException if component is closed, null otherwise
    • notifyListeners

      public void notifyListeners()
      Description copied from interface: ShutdownNotifier
      Protected API - notify the listeners attached to the component
      Specified by:
      notifyListeners in interface ShutdownNotifier
      See Also:
    • removeShutdownListener

      public void removeShutdownListener(ShutdownListener listener)
      Description copied from interface: ShutdownNotifier
      Remove shutdown listener for the component.
      Specified by:
      removeShutdownListener in interface ShutdownNotifier
      listener - ShutdownListener to be removed
    • 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
      true when component is open, false otherwise
    • setShutdownCauseIfOpen

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