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
ShutdownListener
s and remembers the reason for a shutdown. Both
Channel
s and Connection
s have shutdown listeners.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addShutdownListener
(ShutdownListener listener) Add shutdown listener.Get the shutdown reason objectboolean
isOpen()
Determine whether the component is currently open.void
Protected API - notify the listeners attached to the componentvoid
removeShutdownListener
(ShutdownListener listener) Remove shutdown listener for the component.boolean
Internal: this is the means of registering shutdown.
-
Constructor Details
-
ShutdownNotifierComponent
public ShutdownNotifierComponent()
-
-
Method Details
-
addShutdownListener
Description copied from interface:ShutdownNotifier
Add shutdown listener. If the component is already closed, handler is fired immediately- Specified by:
addShutdownListener
in interfaceShutdownNotifier
- Parameters:
listener
-ShutdownListener
to the component
-
getCloseReason
Description copied from interface:ShutdownNotifier
Get the shutdown reason object- Specified by:
getCloseReason
in interfaceShutdownNotifier
- Returns:
- 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 interfaceShutdownNotifier
- See Also:
-
removeShutdownListener
Description copied from interface:ShutdownNotifier
Remove shutdown listener for the component.- Specified by:
removeShutdownListener
in interfaceShutdownNotifier
- Parameters:
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 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:
true
if the component is open;false
otherwise.
-