public class AutorecoveringConnection extends java.lang.Object implements Connection, Recoverable, NetworkConnection
| Constructor and Description |
|---|
AutorecoveringConnection(ConnectionParams params,
FrameHandlerFactory f,
Address[] addrs) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abort this connection and all its channels
with the
AMQP.REPLY_SUCCESS close code
and message 'OK'. |
void |
abort(int timeout)
Abort this connection and all its channels
with the
AMQP.REPLY_SUCCESS close code
and message 'OK'. |
void |
abort(int closeCode,
java.lang.String closeMessage)
Abort this connection and all its channels.
|
void |
abort(int closeCode,
java.lang.String closeMessage,
int timeout)
Abort this connection and all its channels.
|
void |
addBlockedListener(BlockedListener listener)
Add a
BlockedListener. |
void |
addConsumerRecoveryListener(ConsumerRecoveryListener listener)
Not part of the public API.
|
void |
addQueueRecoveryListener(QueueRecoveryListener listener)
Not part of the public API.
|
void |
addRecoveryListener(RecoveryListener listener)
Adds the recovery listener
|
void |
addShutdownListener(ShutdownListener listener)
Add shutdown listener.
|
void |
clearBlockedListeners()
Remove all
BlockedListeners. |
void |
close()
Close this connection and all its channels
with the
AMQP.REPLY_SUCCESS close code
and message 'OK'. |
void |
close(int timeout)
Close this connection and all its channels
with the
AMQP.REPLY_SUCCESS close code
and message 'OK'. |
void |
close(int closeCode,
java.lang.String closeMessage)
Close this connection and all its channels.
|
void |
close(int closeCode,
java.lang.String closeMessage,
int timeout)
Close this connection and all its channels.
|
Channel |
createChannel()
Create a new channel, using an internally allocated channel number.
|
Channel |
createChannel(int channelNumber)
Create a new channel, using the specified channel number if possible.
|
java.net.InetAddress |
getAddress()
Retrieve the host.
|
int |
getChannelMax()
Get the negotiated maximum channel number.
|
java.util.Map<java.lang.String,java.lang.Object> |
getClientProperties()
Get a copy of the map of client properties sent to the server
|
ShutdownSignalException |
getCloseReason()
Get the shutdown reason object
|
ExceptionHandler |
getExceptionHandler()
Get the exception handler.
|
int |
getFrameMax()
Get the negotiated maximum frame size.
|
int |
getHeartbeat()
Get the negotiated heartbeat interval.
|
java.net.InetAddress |
getLocalAddress()
Retrieve the local host.
|
int |
getLocalPort()
Retrieve the local port number.
|
int |
getPort()
Retrieve the port number.
|
java.util.Map<java.lang.String,RecordedExchange> |
getRecordedExchanges() |
java.util.Map<java.lang.String,RecordedQueue> |
getRecordedQueues() |
java.util.Map<java.lang.String,java.lang.Object> |
getServerProperties()
Retrieve the server properties.
|
void |
init()
Private API.
|
boolean |
isOpen()
Determine whether the component is currently open.
|
void |
notifyListeners()
Protected API - notify the listeners attached to the component
|
boolean |
removeBlockedListener(BlockedListener listener)
Remove a
BlockedListener. |
void |
removeConsumerRecoveryListener(ConsumerRecoveryListener listener) |
void |
removeQueueRecoveryListener(QueueRecoveryListener listener) |
void |
removeRecoveryListener(RecoveryListener listener)
Removes the recovery listener
|
void |
removeShutdownListener(ShutdownListener listener)
Remove shutdown listener for the component.
|
protected boolean |
shouldTriggerConnectionRecovery(ShutdownSignalException cause) |
void |
start() |
java.lang.String |
toString() |
public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, Address[] addrs)
public void init()
throws java.io.IOException,
java.util.concurrent.TimeoutException
java.io.IOExceptionjava.util.concurrent.TimeoutExceptionConnectionFactory.newConnection(java.util.concurrent.ExecutorService)public void start()
throws java.io.IOException
java.io.IOExceptionpublic Channel createChannel() throws java.io.IOException
ConnectionRecoverable.createChannel in interface Connectionjava.io.IOException - if an I/O problem is encounteredConnection.createChannel()public Channel createChannel(int channelNumber) throws java.io.IOException
ConnectioncreateChannel in interface ConnectionchannelNumber - the channel number to allocatejava.io.IOException - if an I/O problem is encounteredConnection.createChannel(int)public java.util.Map<java.lang.String,java.lang.Object> getServerProperties()
ConnectiongetServerProperties in interface ConnectionConnection.getServerProperties()public java.util.Map<java.lang.String,java.lang.Object> getClientProperties()
ConnectiongetClientProperties in interface ConnectionConnection.getClientProperties()public int getFrameMax()
ConnectiongetFrameMax in interface ConnectionConnection.getFrameMax()public int getHeartbeat()
ConnectiongetHeartbeat in interface ConnectionConnection.getHeartbeat()public int getChannelMax()
ConnectiongetChannelMax in interface ConnectionConnection.getChannelMax()public boolean isOpen()
ShutdownNotifierisOpen in interface ShutdownNotifierShutdownNotifier.isOpen()public void close()
throws java.io.IOException
ConnectionAMQP.REPLY_SUCCESS close code
and message 'OK'.
Waits for all the close operations to complete.close in interface Connectionjava.io.IOException - if an I/O problem is encounteredConnection.close()public void close(int timeout)
throws java.io.IOException
ConnectionAMQP.REPLY_SUCCESS close code
and message 'OK'.
This method behaves in a similar way as Connection.close(), with the only difference
that it waits with a provided timeout for all the close operations to
complete. When timeout is reached the socket is forced to close.close in interface Connectiontimeout - timeout (in milliseconds) for completing all the close-related
operations, use -1 for infinityjava.io.IOException - if an I/O problem is encounteredConnection.close(int)public void close(int closeCode,
java.lang.String closeMessage,
int timeout)
throws java.io.IOException
Connectionclose in interface ConnectioncloseCode - the close code (See under "Reply Codes" in the AMQP specification)closeMessage - a message indicating the reason for closing the connectiontimeout - timeout (in milliseconds) for completing all the close-related
operations, use -1 for infinityjava.io.IOException - if an I/O problem is encounteredConnection.close(int, String, int)public void abort()
ConnectionAMQP.REPLY_SUCCESS close code
and message 'OK'.
Forces the connection to close.
Any encountered exceptions in the close operations are silently discarded.abort in interface ConnectionConnection.abort()public void abort(int closeCode,
java.lang.String closeMessage,
int timeout)
Connectionabort in interface ConnectioncloseCode - the close code (See under "Reply Codes" in the AMQP specification)closeMessage - a message indicating the reason for closing the connectiontimeout - timeout (in milliseconds) for completing all the close-related
operations, use -1 for infinityConnection.abort(int, String, int)public void abort(int closeCode,
java.lang.String closeMessage)
Connectionabort in interface ConnectioncloseCode - the close code (See under "Reply Codes" in the AMQP specification)closeMessage - a message indicating the reason for closing the connectionConnection.abort(int, String)public void abort(int timeout)
ConnectionAMQP.REPLY_SUCCESS close code
and message 'OK'.
This method behaves in a similar way as Connection.abort(), with the only difference
that it waits with a provided timeout for all the close operations to
complete. When timeout is reached the socket is forced to close.abort in interface Connectiontimeout - timeout (in milliseconds) for completing all the close-related
operations, use -1 for infinityConnection.abort(int)public ShutdownSignalException getCloseReason()
ShutdownNotifiergetCloseReason in interface ShutdownNotifierShutdownNotifier.getCloseReason()public void addBlockedListener(BlockedListener listener)
ConnectionBlockedListener.addBlockedListener in interface Connectionlistener - the listener to addShutdownNotifier.addShutdownListener(com.rabbitmq.client.ShutdownListener)public boolean removeBlockedListener(BlockedListener listener)
ConnectionBlockedListener.removeBlockedListener in interface Connectionlistener - the listener to removetrue if the listener was found and removed,
false otherwiseConnection.removeBlockedListener(com.rabbitmq.client.BlockedListener)public void clearBlockedListeners()
ConnectionBlockedListeners.clearBlockedListeners in interface ConnectionConnection.clearBlockedListeners()public void close(int closeCode,
java.lang.String closeMessage)
throws java.io.IOException
Connectionclose in interface ConnectioncloseCode - the close code (See under "Reply Codes" in the AMQP specification)closeMessage - a message indicating the reason for closing the connectionjava.io.IOException - if an I/O problem is encounteredConnection.close(int, String)public void addShutdownListener(ShutdownListener listener)
ShutdownNotifieraddShutdownListener in interface ShutdownNotifierlistener - ShutdownListener to the componentShutdownNotifier.addShutdownListener(com.rabbitmq.client.ShutdownListener)public void removeShutdownListener(ShutdownListener listener)
ShutdownNotifierremoveShutdownListener in interface ShutdownNotifierlistener - ShutdownListener to be removedShutdownNotifier.removeShutdownListener(com.rabbitmq.client.ShutdownListener)public void notifyListeners()
ShutdownNotifiernotifyListeners in interface ShutdownNotifierShutdownNotifier.notifyListeners()public void addRecoveryListener(RecoveryListener listener)
addRecoveryListener in interface Recoverablelistener - RecoveryListener to execute after this connection recovers from network failurepublic void removeRecoveryListener(RecoveryListener listener)
removeRecoveryListener in interface Recoverablelistener - RecoveryListener to removepublic ExceptionHandler getExceptionHandler()
ConnectiongetExceptionHandler in interface ConnectionAMQConnection.getExceptionHandler()public int getPort()
ConnectiongetPort in interface ConnectiongetPort in interface NetworkConnectionConnection.getPort()public java.net.InetAddress getAddress()
ConnectiongetAddress in interface ConnectiongetAddress in interface NetworkConnectionConnection.getAddress()public java.net.InetAddress getLocalAddress()
NetworkConnectiongetLocalAddress in interface NetworkConnectionpublic int getLocalPort()
NetworkConnectiongetLocalPort in interface NetworkConnectionprotected boolean shouldTriggerConnectionRecovery(ShutdownSignalException cause)
public void addQueueRecoveryListener(QueueRecoveryListener listener)
listener - listener that observes queue name changes after recoverypublic void removeQueueRecoveryListener(QueueRecoveryListener listener)
listener - listener to be removedaddQueueRecoveryListener(com.rabbitmq.client.impl.recovery.QueueRecoveryListener)public void addConsumerRecoveryListener(ConsumerRecoveryListener listener)
listener - listener that observes consumer tag changes after recoverypublic void removeConsumerRecoveryListener(ConsumerRecoveryListener listener)
listener - listener to be removedaddConsumerRecoveryListener(ConsumerRecoveryListener)public java.util.Map<java.lang.String,RecordedQueue> getRecordedQueues()
public java.util.Map<java.lang.String,RecordedExchange> getRecordedExchanges()
public java.lang.String toString()
toString in class java.lang.Object