public abstract class AMQChannel extends ShutdownNotifierComponent
Channel.close()
and
processAsync()
, and may choose to override
processShutdownSignal()
and
rpc()
.ChannelN
,
Connection
Modifier and Type | Class and Description |
---|---|
static class |
AMQChannel.BlockingRpcContinuation<T> |
static interface |
AMQChannel.RpcContinuation |
static class |
AMQChannel.SimpleBlockingRpcContinuation |
Modifier and Type | Field and Description |
---|---|
protected boolean |
_blockContent
Whether transmission of content-bearing methods should be blocked
|
protected Object |
_channelMutex
Protected; used instead of synchronizing on the channel itself,
so that clients can themselves use the channel to synchronize
on.
|
protected int |
_rpcTimeout
Timeout for RPC calls
|
protected static int |
NO_RPC_TIMEOUT |
Constructor and Description |
---|
AMQChannel(AMQConnection connection,
int channelNumber)
Construct a channel on the given connection, with the given channel number.
|
Modifier and Type | Method and Description |
---|---|
void |
asyncRpc(Method m,
CompletableFuture<Command> future) |
void |
enqueueAsyncRpc(Method method,
CompletableFuture<Command> future) |
void |
enqueueRpc(AMQChannel.RpcContinuation k) |
void |
ensureIsOpen() |
CompletableFuture<Command> |
exnWrappingAsyncRpc(Method m) |
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() |
protected void |
markRpcFinished() |
RpcWrapper |
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 |
quiescingAsyncRpc(Method m,
CompletableFuture<Command> future) |
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) |
AMQCommand |
rpc(Method m,
int timeout) |
String |
toString() |
void |
transmit(AMQCommand c) |
void |
transmit(Method m) |
static IOException |
wrap(ShutdownSignalException ex)
Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
|
static IOException |
wrap(ShutdownSignalException ex,
String message) |
protected ChannelContinuationTimeoutException |
wrapTimeoutException(Method m,
TimeoutException e)
Cleans RPC channel state after a timeout and wraps the TimeoutException in a ChannelContinuationTimeoutException
|
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener, setShutdownCauseIfOpen
protected static final int NO_RPC_TIMEOUT
protected final Object _channelMutex
protected volatile boolean _blockContent
protected final int _rpcTimeout
public AMQChannel(AMQConnection connection, int channelNumber)
connection
- the underlying connection for this channelchannelNumber
- the allocated reference number for this channelpublic int getChannelNumber()
public void handleFrame(Frame frame) throws IOException
frame
- the incoming frameIOException
- if an error is encounteredpublic static IOException wrap(ShutdownSignalException ex)
ex
- the exception to wrappublic static IOException wrap(ShutdownSignalException ex, String message)
public AMQCommand exnWrappingRpc(Method m) throws IOException
IOException
public CompletableFuture<Command> exnWrappingAsyncRpc(Method m) throws IOException
IOException
public void handleCompleteInboundCommand(AMQCommand command) throws IOException
command
- the incoming commandIOException
- if there's any problemIOException
public void enqueueRpc(AMQChannel.RpcContinuation k)
public void enqueueAsyncRpc(Method method, CompletableFuture<Command> future)
public boolean isOutstandingRpc()
public RpcWrapper nextOutstandingRpc()
protected void markRpcFinished()
public void ensureIsOpen() throws AlreadyClosedException
AlreadyClosedException
public AMQCommand rpc(Method m) throws IOException, ShutdownSignalException
Method
to the broker and waits for the
next in-bound Command from the broker: only for use from
non-connection-MainLoop threads!IOException
ShutdownSignalException
public AMQCommand rpc(Method m, int timeout) throws IOException, ShutdownSignalException, TimeoutException
protected ChannelContinuationTimeoutException wrapTimeoutException(Method m, TimeoutException e)
public void rpc(Method m, AMQChannel.RpcContinuation k) throws IOException
IOException
public void quiescingRpc(Method m, AMQChannel.RpcContinuation k) throws IOException
IOException
public void asyncRpc(Method m, CompletableFuture<Command> future) throws IOException
IOException
public void quiescingAsyncRpc(Method m, CompletableFuture<Command> future) throws IOException
IOException
public abstract boolean processAsync(Command command) throws IOException
command
- the command to handle asynchronouslyIOException
public void processShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc)
ShutdownSignalException
.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 signalpublic void notifyOutstandingRpc(ShutdownSignalException signal)
public void transmit(Method m) throws IOException
IOException
public void transmit(AMQCommand c) throws IOException
IOException
public void quiescingTransmit(Method m) throws IOException
IOException
public void quiescingTransmit(AMQCommand c) throws IOException
IOException
public AMQConnection getConnection()
Copyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.