Class AbstractKQueueChannel

java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.kqueue.AbstractKQueueChannel
All Implemented Interfaces:
Channel, ChannelOutboundInvoker, UnixChannel, AttributeMap, java.lang.Comparable<Channel>
Direct Known Subclasses:
AbstractKQueueDatagramChannel, AbstractKQueueServerChannel, AbstractKQueueStreamChannel

abstract class AbstractKQueueChannel extends AbstractChannel implements UnixChannel
  • Field Details

    • METADATA

      private static final ChannelMetadata METADATA
    • connectPromise

      private ChannelPromise connectPromise
      The future of the current connection attempt. If not null, subsequent connection attempts will fail.
    • connectTimeoutFuture

      private Future<?> connectTimeoutFuture
    • requestedRemoteAddress

      private java.net.SocketAddress requestedRemoteAddress
    • fastOpenOutboundBuffer

      private ChannelOutboundBuffer fastOpenOutboundBuffer
    • fastOpenData

      private java.lang.Object fastOpenData
    • fastOpenBytes

      private long fastOpenBytes
    • socket

      final BsdSocket socket
    • registration

      private IoRegistration registration
    • readFilterEnabled

      private boolean readFilterEnabled
    • writeFilterEnabled

      private boolean writeFilterEnabled
    • readReadyRunnablePending

      boolean readReadyRunnablePending
    • inputClosedSeenErrorOnRead

      boolean inputClosedSeenErrorOnRead
    • active

      protected volatile boolean active
    • local

      private volatile java.net.SocketAddress local
    • remote

      private volatile java.net.SocketAddress remote
  • Constructor Details

    • AbstractKQueueChannel

      AbstractKQueueChannel(Channel parent, BsdSocket fd, boolean active)
    • AbstractKQueueChannel

      AbstractKQueueChannel(Channel parent, BsdSocket fd, java.net.SocketAddress remote)
  • Method Details

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

      static boolean isSoErrorZero(BsdSocket fd)
    • registration

      protected final IoRegistration registration()
    • fd

      public final FileDescriptor fd()
      Description copied from interface: UnixChannel
      Returns the FileDescriptor that is used by this Channel.
      Specified by:
      fd in interface UnixChannel
    • isActive

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

      public ChannelMetadata metadata()
      Description copied from interface: Channel
      Return the ChannelMetadata of the Channel which describe the nature of the Channel.
      Specified by:
      metadata in interface Channel
    • fastOpenDataSent

      final void fastOpenDataSent(ChannelOutboundBuffer in, java.lang.Object data, long bytes)
      Remember that bytes of data, the current message of in, were sent by a TCP_FASTOPEN_CONNECT.
    • removeFastOpenData

      final boolean removeFastOpenData()
      Removes the bytes that were sent by a TCP_FASTOPEN_CONNECT from the ChannelOutboundBuffer if the channel was connected, and forgets about them otherwise. Must be called before the ChannelOutboundBuffer is written or its messages are failed.
      Returns:
      true if bytes were removed.
    • 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
    • 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
    • resetCachedAddresses

      void resetCachedAddresses()
    • isOpen

      public boolean isOpen()
      Description copied from interface: Channel
      Returns true if the Channel is open and may get active later
      Specified by:
      isOpen in interface Channel
    • 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
    • clearRdHup0

      private void clearRdHup0()
    • submit

      private void submit(KQueueIoOps ops)
    • doBeginRead

      protected final 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
    • 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.
    • newUnsafe

      protected abstract AbstractKQueueChannel.AbstractKQueueUnsafe 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
    • config

      public abstract KQueueChannelConfig config()
      Description copied from interface: Channel
      Returns the configuration of this channel.
      Specified by:
      config in interface Channel
    • newDirectBuffer

      protected final ByteBuf newDirectBuffer(ByteBuf buf)
      Returns an off-heap copy of the specified ByteBuf, and releases the original one.
    • newDirectBuffer

      protected final ByteBuf newDirectBuffer(java.lang.Object holder, ByteBuf buf)
      Returns an off-heap copy of the specified ByteBuf, and releases the specified holder. The caller must ensure that the holder releases the original ByteBuf when the holder is released by this method.
    • newDirectBuffer0

      private static ByteBuf newDirectBuffer0(java.lang.Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity)
    • checkResolvable

      protected static void checkResolvable(java.net.InetSocketAddress addr)
    • doReadBytes

      protected final int doReadBytes(ByteBuf byteBuf) throws java.lang.Exception
      Read bytes into the given ByteBuf and return the amount.
      Throws:
      java.lang.Exception
    • doWriteBytes

      protected final int doWriteBytes(ChannelOutboundBuffer in, ByteBuf buf) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • shouldBreakReadReady

      final boolean shouldBreakReadReady(ChannelConfig config)
    • isAllowHalfClosure

      private static boolean isAllowHalfClosure(ChannelConfig config)
    • clearReadFilter

      final void clearReadFilter()
    • readFilter

      void readFilter(boolean readFilterEnabled) throws java.io.IOException
      Throws:
      java.io.IOException
    • writeFilter

      void writeFilter(boolean writeFilterEnabled) throws java.io.IOException
      Throws:
      java.io.IOException
    • doBind

      protected void doBind(java.net.SocketAddress local) 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
    • doConnect

      protected boolean doConnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress) throws java.lang.Exception
      Connect to the remote peer
      Throws:
      java.lang.Exception
    • doConnect0

      protected boolean doConnect0(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • 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