Package com.rabbitmq.client
Interface ShutdownNotifier
-
- All Known Subinterfaces:
Channel,Connection,RecoverableChannel,RecoverableConnection
- All Known Implementing Classes:
AMQChannel,AMQConnection,AutorecoveringChannel,AutorecoveringConnection,ChannelN,RecoveryAwareAMQConnection,RecoveryAwareChannelN,ShutdownNotifierComponent
public interface ShutdownNotifierInterface for components that are shutdown capable and that allow listeners to be added for shutdown signals- See Also:
ShutdownListener,ShutdownSignalException
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddShutdownListener(ShutdownListener listener)Add shutdown listener.ShutdownSignalExceptiongetCloseReason()Get the shutdown reason objectbooleanisOpen()Determine whether the component is currently open.voidnotifyListeners()Protected API - notify the listeners attached to the componentvoidremoveShutdownListener(ShutdownListener listener)Remove shutdown listener for the component.
-
-
-
Method Detail
-
addShutdownListener
void addShutdownListener(ShutdownListener listener)
Add shutdown listener. If the component is already closed, handler is fired immediately- Parameters:
listener-ShutdownListenerto the component
-
removeShutdownListener
void removeShutdownListener(ShutdownListener listener)
Remove shutdown listener for the component.- Parameters:
listener-ShutdownListenerto be removed
-
getCloseReason
ShutdownSignalException getCloseReason()
Get the shutdown reason object- Returns:
- ShutdownSignalException if component is closed, null otherwise
-
notifyListeners
void notifyListeners()
Protected API - notify the listeners attached to the component- See Also:
ShutdownListener
-
isOpen
boolean isOpen()
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- Returns:
- true when component is open, false otherwise
-
-