Class AMQChannel

    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • _channelLock

        protected final java.util.concurrent.locks.Lock _channelLock
        Protected; used instead of synchronizing on the channel itself, so that clients can themselves use the channel to synchronize on.
      • _channelLockCondition

        protected final java.util.concurrent.locks.Condition _channelLockCondition
      • _connection

        private final AMQConnection _connection
        The connection this channel is associated with.
      • _channelNumber

        private final int _channelNumber
        This channel's channel number.
      • _command

        private AMQCommand _command
        Command being assembled
      • _activeRpc

        private RpcWrapper _activeRpc
        The current outstanding RPC request, if any. (Could become a queue in future.)
      • _blockContent

        protected volatile boolean _blockContent
        Whether transmission of content-bearing methods should be blocked
      • _rpcTimeout

        protected final int _rpcTimeout
        Timeout for RPC calls
      • _checkRpcResponseType

        private final boolean _checkRpcResponseType
      • maxInboundMessageBodySize

        private final int maxInboundMessageBodySize
    • Constructor Detail

      • AMQChannel

        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
    • Method Detail

      • getChannelNumber

        public int getChannelNumber()
        Public API - Retrieves this channel's channel number.
        Returns:
        the channel number
      • handleFrame

        public void handleFrame​(Frame frame)
                         throws java.io.IOException
        Private API - When the Connection receives a Frame for this channel, it passes it to this method.
        Parameters:
        frame - the incoming frame
        Throws:
        java.io.IOException - if an error is encountered
      • wrap

        public static java.io.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
      • exnWrappingRpc

        public AMQCommand exnWrappingRpc​(Method m)
                                  throws java.io.IOException
        Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
        Throws:
        java.io.IOException
      • exnWrappingAsyncRpc

        public java.util.concurrent.CompletableFuture<Command> exnWrappingAsyncRpc​(Method m)
                                                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • handleCompleteInboundCommand

        public void handleCompleteInboundCommand​(AMQCommand command)
                                          throws java.io.IOException
        Private API - handle a command which has been assembled
        Parameters:
        command - the incoming command
        Throws:
        java.io.IOException - if there's any problem
        java.io.IOException
      • enqueueAsyncRpc

        public void enqueueAsyncRpc​(Method method,
                                    java.util.concurrent.CompletableFuture<Command> future)
      • doEnqueueRpc

        private void doEnqueueRpc​(java.util.function.Supplier<RpcWrapper> rpcWrapperSupplier)
      • isOutstandingRpc

        public boolean isOutstandingRpc()
      • nextOutstandingRpc

        public RpcWrapper nextOutstandingRpc()
      • markRpcFinished

        protected void markRpcFinished()
      • cleanRpcChannelState

        private void cleanRpcChannelState()
      • wrapTimeoutException

        protected ChannelContinuationTimeoutException wrapTimeoutException​(Method m,
                                                                           java.util.concurrent.TimeoutException e)
        Cleans RPC channel state after a timeout and wraps the TimeoutException in a ChannelContinuationTimeoutException
      • asyncRpc

        public void asyncRpc​(Method m,
                             java.util.concurrent.CompletableFuture<Command> future)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • quiescingAsyncRpc

        public void quiescingAsyncRpc​(Method m,
                                      java.util.concurrent.CompletableFuture<Command> future)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • processAsync

        public abstract boolean processAsync​(Command command)
                                      throws java.io.IOException
        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:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • processShutdownSignal

        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
      • transmit

        public void transmit​(Method m)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • transmit

        public void transmit​(AMQCommand c)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • quiescingTransmit

        public void quiescingTransmit​(Method m)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • quiescingTransmit

        public void quiescingTransmit​(AMQCommand c)
                               throws java.io.IOException
        Throws:
        java.io.IOException