com.rabbitmq.client.impl.recovery
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
BlockedListener s. |
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.
|
void |
start() |
public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, Address[] addrs)
public void init() throws java.io.IOException
java.io.IOException
ConnectionFactory.newConnection(java.util.concurrent.ExecutorService)
public void start() throws java.io.IOException
java.io.IOException
public Channel createChannel() throws java.io.IOException
Connection
createChannel
in interface Connection
java.io.IOException
- if an I/O problem is encounteredConnection.createChannel()
public Channel createChannel(int channelNumber) throws java.io.IOException
Connection
createChannel
in interface Connection
channelNumber
- 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()
Connection
getServerProperties
in interface Connection
Connection.getServerProperties()
public java.util.Map<java.lang.String,java.lang.Object> getClientProperties()
Connection
getClientProperties
in interface Connection
Connection.getClientProperties()
public int getFrameMax()
Connection
getFrameMax
in interface Connection
Connection.getFrameMax()
public int getHeartbeat()
Connection
getHeartbeat
in interface Connection
Connection.getHeartbeat()
public int getChannelMax()
Connection
getChannelMax
in interface Connection
Connection.getChannelMax()
public boolean isOpen()
ShutdownNotifier
isOpen
in interface ShutdownNotifier
ShutdownNotifier.isOpen()
public void close() throws java.io.IOException
Connection
AMQP.REPLY_SUCCESS
close code
and message 'OK'.
Waits for all the close operations to complete.close
in interface Connection
java.io.IOException
- if an I/O problem is encounteredConnection.close()
public void close(int timeout) throws java.io.IOException
Connection
AMQP.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 Connection
timeout
- 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
Connection
close
in interface Connection
closeCode
- 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()
Connection
AMQP.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 Connection
Connection.abort()
public void abort(int closeCode, java.lang.String closeMessage, int timeout)
Connection
abort
in interface Connection
closeCode
- 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)
Connection
abort
in interface Connection
closeCode
- 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)
Connection
AMQP.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 Connection
timeout
- timeout (in milliseconds) for completing all the close-related
operations, use -1 for infinityConnection.abort(int)
public ShutdownSignalException getCloseReason()
ShutdownNotifier
getCloseReason
in interface ShutdownNotifier
ShutdownNotifier.getCloseReason()
public void addBlockedListener(BlockedListener listener)
Connection
BlockedListener
.addBlockedListener
in interface Connection
listener
- the listener to addShutdownNotifier.addShutdownListener(com.rabbitmq.client.ShutdownListener)
public boolean removeBlockedListener(BlockedListener listener)
Connection
BlockedListener
.removeBlockedListener
in interface Connection
listener
- the listener to removetrue
if the listener was found and removed,
false
otherwiseConnection.removeBlockedListener(com.rabbitmq.client.BlockedListener)
public void clearBlockedListeners()
Connection
BlockedListener
s.clearBlockedListeners
in interface Connection
Connection.clearBlockedListeners()
public void close(int closeCode, java.lang.String closeMessage) throws java.io.IOException
Connection
close
in interface Connection
closeCode
- 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)
ShutdownNotifier
addShutdownListener
in interface ShutdownNotifier
listener
- ShutdownListener
to the componentShutdownNotifier.addShutdownListener(com.rabbitmq.client.ShutdownListener)
public void removeShutdownListener(ShutdownListener listener)
ShutdownNotifier
removeShutdownListener
in interface ShutdownNotifier
listener
- ShutdownListener
to be removedShutdownNotifier.removeShutdownListener(com.rabbitmq.client.ShutdownListener)
public void notifyListeners()
ShutdownNotifier
notifyListeners
in interface ShutdownNotifier
ShutdownNotifier.notifyListeners()
public void addRecoveryListener(RecoveryListener listener)
addRecoveryListener
in interface Recoverable
listener
- RecoveryListener
to execute after this connection recovers from network failurepublic void removeRecoveryListener(RecoveryListener listener)
removeRecoveryListener
in interface Recoverable
listener
- RecoveryListener
to removepublic ExceptionHandler getExceptionHandler()
Connection
getExceptionHandler
in interface Connection
AMQConnection.getExceptionHandler()
public int getPort()
Connection
getPort
in interface Connection
getPort
in interface NetworkConnection
Connection.getPort()
public java.net.InetAddress getAddress()
Connection
getAddress
in interface Connection
getAddress
in interface NetworkConnection
Connection.getAddress()
public java.net.InetAddress getLocalAddress()
NetworkConnection
getLocalAddress
in interface NetworkConnection
public int getLocalPort()
NetworkConnection
getLocalPort
in interface NetworkConnection
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()