Package com.rabbitmq.client.impl
Class ShutdownNotifierComponent
java.lang.Object
com.rabbitmq.client.impl.ShutdownNotifierComponent
- All Implemented Interfaces:
ShutdownNotifier
- Direct Known Subclasses:
AMQChannel,AMQConnection
A class that manages
ShutdownListeners and remembers the reason for a shutdown. Both
Channels and Connections have shutdown listeners.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddShutdownListener(ShutdownListener listener) Add shutdown listener.Get the shutdown reason objectbooleanisOpen()Determine whether the component is currently open.voidProtected API - notify the listeners attached to the componentvoidremoveShutdownListener(ShutdownListener listener) Remove shutdown listener for the component.booleanInternal: this is the means of registering shutdown.
-
Constructor Details
-
ShutdownNotifierComponent
public ShutdownNotifierComponent()
-
-
Method Details
-
addShutdownListener
Description copied from interface:ShutdownNotifierAdd shutdown listener. If the component is already closed, handler is fired immediately- Specified by:
addShutdownListenerin interfaceShutdownNotifier- Parameters:
listener-ShutdownListenerto the component
-
getCloseReason
Description copied from interface:ShutdownNotifierGet the shutdown reason object- Specified by:
getCloseReasonin interfaceShutdownNotifier- Returns:
- ShutdownSignalException if component is closed, null otherwise
-
notifyListeners
public void notifyListeners()Description copied from interface:ShutdownNotifierProtected API - notify the listeners attached to the component- Specified by:
notifyListenersin interfaceShutdownNotifier- See Also:
-
removeShutdownListener
Description copied from interface:ShutdownNotifierRemove shutdown listener for the component.- Specified by:
removeShutdownListenerin interfaceShutdownNotifier- Parameters:
listener-ShutdownListenerto be removed
-
isOpen
public boolean isOpen()Description copied from interface:ShutdownNotifierDetermine 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:
isOpenin interfaceShutdownNotifier- Returns:
- true when component is open, false otherwise
-
setShutdownCauseIfOpen
Internal: this is the means of registering shutdown.- Parameters:
sse- the reason for the shutdown- Returns:
trueif the component is open;falseotherwise.
-