public abstract class

AMQChannel

extends ShutdownNotifierComponent
java.lang.Object
   ↳ com.rabbitmq.client.impl.ShutdownNotifierComponent
     ↳ com.rabbitmq.client.impl.AMQChannel
Known Direct Subclasses

Class Overview

Base class modelling an AMQ channel. Subclasses implement close() and processAsync(), and may choose to override processShutdownSignal() and rpc().

Summary

Nested Classes
class AMQChannel.BlockingRpcContinuation<T>  
interface AMQChannel.RpcContinuation  
class AMQChannel.SimpleBlockingRpcContinuation  
Fields
public boolean _blockContent Whether transmission of content-bearing methods should be blocked
protected final Object _channelMutex Protected; used instead of synchronizing on the channel itself, so that clients can themselves use the channel to synchronize on.
Public Constructors
AMQChannel(AMQConnection connection, int channelNumber)
Construct a channel on the given connection, with the given channel number.
Public Methods
void enqueueRpc(AMQChannel.RpcContinuation k)
void ensureIsOpen()
AMQCommand exnWrappingRpc(Method m)
Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
int getChannelNumber()
Public API - Retrieves this channel's channel number.
AMQConnection getConnection()
void handleCompleteInboundCommand(AMQCommand command)
Private API - handle a command which has been assembled
void handleFrame(Frame frame)
Private API - When the Connection receives a Frame for this channel, it passes it to this method.
boolean isOutstandingRpc()
AMQChannel.RpcContinuation nextOutstandingRpc()
void notifyOutstandingRpc(ShutdownSignalException signal)
abstract boolean processAsync(Command command)
Protected API - called by nextCommand to check possibly handle an incoming Command before it is returned to the caller of nextCommand.
void processShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc)
Protected API - respond, in the driver thread, to a ShutdownSignalException.
void quiescingRpc(Method m, AMQChannel.RpcContinuation k)
void quiescingTransmit(AMQCommand c)
void quiescingTransmit(Method m)
AMQCommand rpc(Method m)
Protected API - sends a Method to the broker and waits for the next in-bound Command from the broker: only for use from non-connection-MainLoop threads!
void rpc(Method m, AMQChannel.RpcContinuation k)
String toString()
void transmit(AMQCommand c)
void transmit(Method m)
static IOException wrap(ShutdownSignalException ex, String message)
static IOException wrap(ShutdownSignalException ex)
Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
[Expand]
Inherited Methods
From class com.rabbitmq.client.impl.ShutdownNotifierComponent
From class java.lang.Object
From interface com.rabbitmq.client.ShutdownNotifier

Fields

public boolean _blockContent

Whether transmission of content-bearing methods should be blocked

protected final Object _channelMutex

Protected; used instead of synchronizing on the channel itself, so that clients can themselves use the channel to synchronize on.

Public Constructors

public AMQChannel (AMQConnection connection, int channelNumber)

Construct a channel on the given connection, with the given channel number.

Parameters
connection the underlying connection for this channel
channelNumber the allocated reference number for this channel

Public Methods

public void enqueueRpc (AMQChannel.RpcContinuation k)

public void ensureIsOpen ()

public AMQCommand exnWrappingRpc (Method m)

Placeholder until we address bug 15786 (implementing a proper exception hierarchy).

Throws
IOException

public int getChannelNumber ()

Public API - Retrieves this channel's channel number.

Returns
  • the channel number

public AMQConnection getConnection ()

public void handleCompleteInboundCommand (AMQCommand command)

Private API - handle a command which has been assembled

Parameters
command the incoming command
Throws
IOException if there's any problem
IOException

public void handleFrame (Frame frame)

Private API - When the Connection receives a Frame for this channel, it passes it to this method.

Parameters
frame the incoming frame
Throws
IOException if an error is encountered

public boolean isOutstandingRpc ()

public AMQChannel.RpcContinuation nextOutstandingRpc ()

public void notifyOutstandingRpc (ShutdownSignalException signal)

public abstract boolean processAsync (Command command)

Protected API - called by nextCommand to check possibly handle an incoming Command before it is returned to the caller of nextCommand. If this method returns true, the command is considered handled and is not passed back to nextCommand's caller; if it returns false, nextCommand returns the command as usual. This is used in subclasses to implement handling of Basic.Return and Basic.Deliver messages, as well as Channel.Close and Connection.Close.

Parameters
command the command to handle asynchronously
Returns
  • true if we handled the command; otherwise the caller should consider it "unhandled"
Throws
IOException

public void processShutdownSignal (ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc)

Protected API - respond, in the driver thread, to a ShutdownSignalException.

Parameters
signal the signal to handle
ignoreClosed the flag indicating whether to ignore the AlreadyClosedException thrown when the channel is already closed
notifyRpc the flag indicating whether any remaining rpc continuation should be notified with the given signal

public void quiescingRpc (Method m, AMQChannel.RpcContinuation k)

Throws
IOException

public void quiescingTransmit (AMQCommand c)

Throws
IOException

public void quiescingTransmit (Method m)

Throws
IOException

public AMQCommand rpc (Method m)

Protected API - sends a Method to the broker and waits for the next in-bound Command from the broker: only for use from non-connection-MainLoop threads!

public void rpc (Method m, AMQChannel.RpcContinuation k)

Throws
IOException

public String toString ()

public void transmit (AMQCommand c)

Throws
IOException

public void transmit (Method m)

Throws
IOException

public static IOException wrap (ShutdownSignalException ex, String message)

public static IOException wrap (ShutdownSignalException ex)

Placeholder until we address bug 15786 (implementing a proper exception hierarchy). In the meantime, this at least won't throw away any information from the wrapped exception.

Parameters
ex the exception to wrap
Returns
  • the wrapped exception