Class LocalChannel

java.lang.Object
All Implemented Interfaces:
Channel, ChannelOutboundInvoker, AttributeMap, java.lang.Comparable<Channel>

public class LocalChannel extends AbstractChannel
A Channel for the local transport.
  • Field Details

    • logger

      private static final InternalLogger logger
    • FINISH_READ_FUTURE_UPDATER

      private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<LocalChannel, Future> FINISH_READ_FUTURE_UPDATER
    • STATE_UPDATER

      private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<LocalChannel, LocalChannel.State> STATE_UPDATER
    • METADATA

      private static final ChannelMetadata METADATA
    • MAX_READER_STACK_DEPTH

      private static final int MAX_READER_STACK_DEPTH
      See Also:
    • config

      private final ChannelConfig config
    • inboundBuffer

      final java.util.Queue<java.lang.Object> inboundBuffer
    • readTask

      private final java.lang.Runnable readTask
    • finishReadTask

      private final java.lang.Runnable finishReadTask
    • registration

      private IoRegistration registration
    • state

      private volatile LocalChannel.State state
    • peer

      private volatile LocalChannel peer
    • localAddress

      private volatile LocalAddress localAddress
    • remoteAddress

      private volatile LocalAddress remoteAddress
    • connectPromise

      private volatile ChannelPromise connectPromise
    • readInProgress

      private volatile boolean readInProgress
    • writeInProgress

      private volatile boolean writeInProgress
    • finishReadFuture

      private volatile Future<?> finishReadFuture
  • Constructor Details

  • Method Details

    • metadata

      public ChannelMetadata metadata()
      Description copied from interface: Channel
      Return the ChannelMetadata of the Channel which describe the nature of the Channel.
    • config

      public ChannelConfig config()
      Description copied from interface: Channel
      Returns the configuration of this channel.
    • parent

      public LocalServerChannel parent()
      Description copied from interface: Channel
      Returns the parent of this channel.
      Specified by:
      parent in interface Channel
      Overrides:
      parent in class AbstractChannel
      Returns:
      the parent channel. null if this channel does not have a parent channel.
    • localAddress

      public LocalAddress localAddress()
      Description copied from interface: Channel
      Returns the local address where this channel is bound to. The returned SocketAddress is supposed to be down-cast into more concrete type such as InetSocketAddress to retrieve the detailed information.
      Specified by:
      localAddress in interface Channel
      Overrides:
      localAddress in class AbstractChannel
      Returns:
      the local address of this channel. null if this channel is not bound.
    • remoteAddress

      public LocalAddress remoteAddress()
      Description copied from interface: Channel
      Returns the remote address where this channel is connected to. The returned SocketAddress is supposed to be down-cast into more concrete type such as InetSocketAddress to retrieve the detailed information.
      Specified by:
      remoteAddress in interface Channel
      Overrides:
      remoteAddress in class AbstractChannel
      Returns:
      the remote address of this channel. null if this channel is not connected. If this channel is not connected but it can receive messages from arbitrary remote addresses (e.g. DatagramChannel, use DefaultAddressedEnvelope.recipient() to determine the origination of the received message as this method will return null.
    • isOpen

      public boolean isOpen()
      Description copied from interface: Channel
      Returns true if the Channel is open and may get active later
    • isActive

      public boolean isActive()
      Description copied from interface: Channel
      Return true if the Channel is active and so connected.
    • newUnsafe

      protected AbstractChannel.AbstractUnsafe newUnsafe()
      Description copied from class: AbstractChannel
      Create a new AbstractChannel.AbstractUnsafe instance which will be used for the life-time of the Channel
      Specified by:
      newUnsafe in class AbstractChannel
    • isCompatible

      protected boolean isCompatible(EventLoop loop)
      Description copied from class: AbstractChannel
      Return true if the given EventLoop is compatible with this instance.
      Specified by:
      isCompatible in class AbstractChannel
    • localAddress0

      protected java.net.SocketAddress localAddress0()
      Description copied from class: AbstractChannel
      Returns the SocketAddress which is bound locally.
      Specified by:
      localAddress0 in class AbstractChannel
    • remoteAddress0

      protected java.net.SocketAddress remoteAddress0()
      Description copied from class: AbstractChannel
      Return the SocketAddress which the Channel is connected to.
      Specified by:
      remoteAddress0 in class AbstractChannel
    • doRegister

      protected void doRegister(ChannelPromise promise)
      Description copied from class: AbstractChannel
      Is called after the Channel is registered with its EventLoop as part of the register process. Subclasses may override this method
      Overrides:
      doRegister in class AbstractChannel
      Parameters:
      promise - ChannelPromise that must be notified once done to continue the registration.
    • doDeregister

      protected void doDeregister() throws java.lang.Exception
      Description copied from class: AbstractChannel
      Deregister the Channel from its EventLoop. Sub-classes may override this method
      Overrides:
      doDeregister in class AbstractChannel
      Throws:
      java.lang.Exception
    • doBind

      protected void doBind(java.net.SocketAddress localAddress) throws java.lang.Exception
      Description copied from class: AbstractChannel
      Bind the Channel to the SocketAddress
      Specified by:
      doBind in class AbstractChannel
      Throws:
      java.lang.Exception
    • doDisconnect

      protected void doDisconnect() throws java.lang.Exception
      Description copied from class: AbstractChannel
      Disconnect this Channel from its remote peer
      Specified by:
      doDisconnect in class AbstractChannel
      Throws:
      java.lang.Exception
    • doClose

      protected void doClose() throws java.lang.Exception
      Description copied from class: AbstractChannel
      Close the Channel
      Specified by:
      doClose in class AbstractChannel
      Throws:
      java.lang.Exception
    • tryClose

      private void tryClose(boolean isActive)
    • readInboundBeforeClose

      private void readInboundBeforeClose()
    • readInbound

      private void readInbound()
    • doBeginRead

      protected void doBeginRead() throws java.lang.Exception
      Description copied from class: AbstractChannel
      Schedule a read operation.
      Specified by:
      doBeginRead in class AbstractChannel
      Throws:
      java.lang.Exception
    • doWrite

      protected void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
      Description copied from class: AbstractChannel
      Flush the content of the given buffer to the remote peer.
      Specified by:
      doWrite in class AbstractChannel
      Throws:
      java.lang.Exception
    • finishPeerRead

      private void finishPeerRead(LocalChannel peer)
    • runFinishTask0

      private void runFinishTask0()
    • runFinishPeerReadTask

      private void runFinishPeerReadTask(LocalChannel peer)
    • releaseInboundBuffers

      private void releaseInboundBuffers()
    • finishPeerRead0

      private void finishPeerRead0(LocalChannel peer)