Package com.rabbitmq.client.impl
Class AMQChannel
java.lang.Object
com.rabbitmq.client.impl.ShutdownNotifierComponent
com.rabbitmq.client.impl.AMQChannel
- All Implemented Interfaces:
 ShutdownNotifier
- Direct Known Subclasses:
 ChannelN
Base class modelling an AMQ channel. Subclasses implement
 
Channel.close() and
 processAsync(), and may choose to override
 processShutdownSignal() and
 rpc().- See Also:
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic class - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether transmission of content-bearing methods should be blockedprotected final LockProtected; used instead of synchronizing on the channel itself, so that clients can themselves use the channel to synchronize on.protected final Conditionprotected final intTimeout for RPC callsprotected static final int - 
Constructor Summary
ConstructorsConstructorDescriptionAMQChannel(AMQConnection connection, int channelNumber) Construct a channel on the given connection, with the given channel number. - 
Method Summary
Modifier and TypeMethodDescriptionvoidasyncRpc(Method m, CompletableFuture<Command> future) protected ObservationCollector.ConnectionInfovoidenqueueAsyncRpc(Method method, CompletableFuture<Command> future) voidvoidPlaceholder until we address bug 15786 (implementing a proper exception hierarchy).intPublic API - Retrieves this channel's channel number.voidhandleCompleteInboundCommand(AMQCommand command) Private API - handle a command which has been assembledvoidhandleFrame(Frame frame) Private API - When the Connection receives a Frame for this channel, it passes it to this method.booleanprotected voidvoidabstract booleanprocessAsync(Command command) Protected API - called by nextCommand to check possibly handle an incoming Command before it is returned to the caller of nextCommand.voidprocessShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc) Protected API - respond, in the driver thread, to aShutdownSignalException.voidquiescingAsyncRpc(Method m, CompletableFuture<Command> future) voidvoidvoidProtected API - sends aMethodto the broker and waits for the next in-bound Command from the broker: only for use from non-connection-MainLoop threads!voidtoString()voidvoidstatic IOExceptionPlaceholder until we address bug 15786 (implementing a proper exception hierarchy).static IOExceptionwrap(ShutdownSignalException ex, String message) protected ChannelContinuationTimeoutExceptionCleans RPC channel state after a timeout and wraps the TimeoutException in a ChannelContinuationTimeoutExceptionMethods inherited from class com.rabbitmq.client.impl.ShutdownNotifierComponent
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener, setShutdownCauseIfOpen 
- 
Field Details
- 
NO_RPC_TIMEOUT
protected static final int NO_RPC_TIMEOUT- See Also:
 
 - 
_channelLock
Protected; used instead of synchronizing on the channel itself, so that clients can themselves use the channel to synchronize on. - 
_channelLockCondition
 - 
_blockContent
protected volatile boolean _blockContentWhether transmission of content-bearing methods should be blocked - 
_rpcTimeout
protected final int _rpcTimeoutTimeout for RPC calls 
 - 
 - 
Constructor Details
- 
AMQChannel
Construct a channel on the given connection, with the given channel number.- Parameters:
 connection- the underlying connection for this channelchannelNumber- the allocated reference number for this channel
 
 - 
 - 
Method Details
- 
getChannelNumber
public int getChannelNumber()Public API - Retrieves this channel's channel number.- Returns:
 - the channel number
 
 - 
handleFrame
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
 - 
wrap
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
 
 - 
wrap
 - 
exnWrappingRpc
Placeholder until we address bug 15786 (implementing a proper exception hierarchy).- Throws:
 IOException
 - 
exnWrappingAsyncRpc
- Throws:
 IOException
 - 
handleCompleteInboundCommand
Private API - handle a command which has been assembled- Parameters:
 command- the incoming command- Throws:
 IOException- if there's any problemIOException
 - 
enqueueRpc
 - 
enqueueAsyncRpc
 - 
isOutstandingRpc
public boolean isOutstandingRpc() - 
nextOutstandingRpc
 - 
markRpcFinished
protected void markRpcFinished() - 
ensureIsOpen
- Throws:
 AlreadyClosedException
 - 
rpc
Protected API - sends aMethodto the broker and waits for the next in-bound Command from the broker: only for use from non-connection-MainLoop threads!- Throws:
 IOExceptionShutdownSignalException
 - 
rpc
public AMQCommand rpc(Method m, int timeout) throws IOException, ShutdownSignalException, TimeoutException  - 
wrapTimeoutException
Cleans RPC channel state after a timeout and wraps the TimeoutException in a ChannelContinuationTimeoutException - 
rpc
- Throws:
 IOException
 - 
quiescingRpc
- Throws:
 IOException
 - 
asyncRpc
- Throws:
 IOException
 - 
quiescingAsyncRpc
- Throws:
 IOException
 - 
processAsync
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
 - 
toString
 - 
processShutdownSignal
public void processShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc) Protected API - respond, in the driver thread, to aShutdownSignalException.- Parameters:
 signal- the signal to handleignoreClosed- the flag indicating whether to ignore the AlreadyClosedException thrown when the channel is already closednotifyRpc- the flag indicating whether any remaining rpc continuation should be notified with the given signal
 - 
notifyOutstandingRpc
 - 
transmit
- Throws:
 IOException
 - 
transmit
- Throws:
 IOException
 - 
quiescingTransmit
- Throws:
 IOException
 - 
quiescingTransmit
- Throws:
 IOException
 - 
getConnection
 - 
connectionInfo
 
 -