Class Plc4xEmbeddedChannel

java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.embedded.Plc4xEmbeddedChannel
All Implemented Interfaces:
EventLoopProvider, io.netty.channel.Channel, io.netty.channel.ChannelOutboundInvoker, io.netty.util.AttributeMap, Comparable<io.netty.channel.Channel>

public class Plc4xEmbeddedChannel extends io.netty.channel.AbstractChannel implements EventLoopProvider
Base class for Channel implementations that are used in an embedded fashion.
  • Nested Class Summary

    Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel

    io.netty.channel.AbstractChannel.AbstractUnsafe

    Nested classes/interfaces inherited from interface io.netty.channel.Channel

    io.netty.channel.Channel.Unsafe
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new instance with an EmbeddedChannelId and an empty pipeline.
    Plc4xEmbeddedChannel(boolean register, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId)
    Create a new instance with the specified ID and an empty pipeline.
    Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, boolean register, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, boolean hasDisconnect, io.netty.channel.ChannelConfig config, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
    Plc4xEmbeddedChannel(io.netty.channel.Channel parent, io.netty.channel.ChannelId channelId, boolean register, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
    Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Check if there was any Throwable received and if so rethrow it.
    final io.netty.channel.ChannelFuture
     
    final io.netty.channel.ChannelFuture
    close(io.netty.channel.ChannelPromise promise)
     
    io.netty.channel.ChannelConfig
     
    final io.netty.channel.ChannelFuture
     
    final io.netty.channel.ChannelFuture
    disconnect(io.netty.channel.ChannelPromise promise)
     
    protected void
     
    protected void
    doBind(SocketAddress localAddress)
     
    protected void
     
    protected void
     
    protected void
     
    protected void
    doWrite(io.netty.channel.ChannelOutboundBuffer in)
     
    protected final void
    Ensure the Channel is open and if not throw an exception.
    boolean
    Mark this Channel as finished.
    boolean
    Mark this Channel as finished and release all pending message in the inbound and outbound buffer.
    Flushes the inbound of this Channel.
    Flushes the outbound of this Channel.
    io.netty.channel.EventLoop
     
    protected void
    Called for each inbound message.
    protected void
    Called for each outbound message.
    Returns the Queue which holds all the Objects that were received by this Channel.
    boolean
     
    protected boolean
    isCompatible(io.netty.channel.EventLoop loop)
     
    boolean
     
    boolean
     
    Deprecated.
    Deprecated.
    protected SocketAddress
     
    io.netty.channel.ChannelMetadata
     
    protected final io.netty.channel.DefaultChannelPipeline
     
    protected io.netty.channel.AbstractChannel.AbstractUnsafe
     
    Returns the Queue which holds all the Objects that were written by this Channel.
    <T> T
    Return received data from this Channel
    <T> T
    Read data from the outbound.
    void
    Register this Channel on its EventLoop.
    boolean
    Release all buffered inbound messages and return true if any were in the inbound buffer, false otherwise.
    boolean
    Release all buffered outbound messages and return true if any were in the outbound buffer, false otherwise.
    protected SocketAddress
     
    void
    Run all tasks (which also includes scheduled tasks) that are pending in the EventLoop for this Channel
    long
    Run all pending scheduled tasks in the EventLoop for this Channel and return the nanoseconds when the next scheduled task is ready to run.
    io.netty.channel.Channel.Unsafe
     
    boolean
    Write messages to the inbound of this Channel.
    io.netty.channel.ChannelFuture
    Writes one message to the inbound of this Channel and does not flush it.
    io.netty.channel.ChannelFuture
    writeOneInbound(Object msg, io.netty.channel.ChannelPromise promise)
    Writes one message to the inbound of this Channel and does not flush it.
    io.netty.channel.ChannelFuture
    Writes one message to the outbound of this Channel and does not flush it.
    io.netty.channel.ChannelFuture
    writeOneOutbound(Object msg, io.netty.channel.ChannelPromise promise)
    Writes one message to the outbound of this Channel and does not flush it.
    boolean
    Write messages to the outbound of this Channel.

    Methods inherited from class io.netty.channel.AbstractChannel

    alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, doDeregister, doShutdownOutput, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isWritable, localAddress, maxMessagesPerWrite, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, toString, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlush

    Methods inherited from class io.netty.util.DefaultAttributeMap

    attr, hasAttr

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.netty.util.AttributeMap

    attr, hasAttr
  • Constructor Details

    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel()
      Create a new instance with an EmbeddedChannelId and an empty pipeline.
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId)
      Create a new instance with the specified ID and an empty pipeline.
      Parameters:
      channelId - the ChannelId that will be used to identify this channel
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the pipeline initialized with the specified handlers.
      Parameters:
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the pipeline initialized with the specified handlers.
      Parameters:
      hasDisconnect - false if this Channel will delegate disconnect() to close(), false otherwise.
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(boolean register, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the pipeline initialized with the specified handlers.
      Parameters:
      register - true if this Channel is registered to the EventLoop in the constructor. If false the user will need to call register().
      hasDisconnect - false if this Channel will delegate disconnect() to close(), false otherwise.
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
      Parameters:
      channelId - the ChannelId that will be used to identify this channel
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
      Parameters:
      channelId - the ChannelId that will be used to identify this channel
      hasDisconnect - false if this Channel will delegate disconnect() to close(), false otherwise.
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, boolean register, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
      Parameters:
      channelId - the ChannelId that will be used to identify this channel
      register - true if this Channel is registered to the EventLoop in the constructor. If false the user will need to call register().
      hasDisconnect - false if this Channel will delegate disconnect() to close(), false otherwise.
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.Channel parent, io.netty.channel.ChannelId channelId, boolean register, boolean hasDisconnect, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
      Parameters:
      parent - the parent Channel of this EmbeddedChannel.
      channelId - the ChannelId that will be used to identify this channel
      register - true if this Channel is registered to the EventLoop in the constructor. If false the user will need to call register().
      hasDisconnect - false if this Channel will delegate disconnect() to close(), false otherwise.
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
    • Plc4xEmbeddedChannel

      public Plc4xEmbeddedChannel(io.netty.channel.ChannelId channelId, boolean hasDisconnect, io.netty.channel.ChannelConfig config, io.netty.channel.ChannelHandler... handlers)
      Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
      Parameters:
      channelId - the ChannelId that will be used to identify this channel
      hasDisconnect - false if this Channel will delegate disconnect() to close(), false otherwise.
      config - the ChannelConfig which will be returned by config().
      handlers - the ChannelHandlers which will be add in the ChannelPipeline
  • Method Details

    • getEventLoop

      public io.netty.channel.EventLoop getEventLoop()
      Specified by:
      getEventLoop in interface EventLoopProvider
    • isRegistered

      public boolean isRegistered()
      Specified by:
      isRegistered in interface io.netty.channel.Channel
      Overrides:
      isRegistered in class io.netty.channel.AbstractChannel
    • register

      public void register() throws Exception
      Register this Channel on its EventLoop.
      Throws:
      Exception
    • newChannelPipeline

      protected final io.netty.channel.DefaultChannelPipeline newChannelPipeline()
      Overrides:
      newChannelPipeline in class io.netty.channel.AbstractChannel
    • metadata

      public io.netty.channel.ChannelMetadata metadata()
      Specified by:
      metadata in interface io.netty.channel.Channel
    • config

      public io.netty.channel.ChannelConfig config()
      Specified by:
      config in interface io.netty.channel.Channel
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface io.netty.channel.Channel
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface io.netty.channel.Channel
    • inboundMessages

      public Queue<Object> inboundMessages()
      Returns the Queue which holds all the Objects that were received by this Channel.
    • lastInboundBuffer

      @Deprecated public Queue<Object> lastInboundBuffer()
      Deprecated.
    • outboundMessages

      public Queue<Object> outboundMessages()
      Returns the Queue which holds all the Objects that were written by this Channel.
    • lastOutboundBuffer

      @Deprecated public Queue<Object> lastOutboundBuffer()
      Deprecated.
    • readInbound

      public <T> T readInbound()
      Return received data from this Channel
    • readOutbound

      public <T> T readOutbound()
      Read data from the outbound. This may return null if nothing is readable.
    • writeInbound

      public boolean writeInbound(Object... msgs)
      Write messages to the inbound of this Channel.
      Parameters:
      msgs - the messages to be written
      Returns:
      true if the write operation did add something to the inbound buffer
    • writeOneInbound

      public io.netty.channel.ChannelFuture writeOneInbound(Object msg)
      Writes one message to the inbound of this Channel and does not flush it. This method is conceptually equivalent to AbstractChannel.write(Object).
      See Also:
    • writeOneInbound

      public io.netty.channel.ChannelFuture writeOneInbound(Object msg, io.netty.channel.ChannelPromise promise)
      Writes one message to the inbound of this Channel and does not flush it. This method is conceptually equivalent to AbstractChannel.write(Object, ChannelPromise).
      See Also:
    • flushInbound

      public Plc4xEmbeddedChannel flushInbound()
      Flushes the inbound of this Channel. This method is conceptually equivalent to AbstractChannel.flush().
      See Also:
    • writeOutbound

      public boolean writeOutbound(Object... msgs)
      Write messages to the outbound of this Channel.
      Parameters:
      msgs - the messages to be written
      Returns:
      bufferReadable returns true if the write operation did add something to the outbound buffer
    • writeOneOutbound

      public io.netty.channel.ChannelFuture writeOneOutbound(Object msg)
      Writes one message to the outbound of this Channel and does not flush it. This method is conceptually equivalent to AbstractChannel.write(Object).
      See Also:
    • writeOneOutbound

      public io.netty.channel.ChannelFuture writeOneOutbound(Object msg, io.netty.channel.ChannelPromise promise)
      Writes one message to the outbound of this Channel and does not flush it. This method is conceptually equivalent to AbstractChannel.write(Object, ChannelPromise).
      See Also:
    • flushOutbound

      public Plc4xEmbeddedChannel flushOutbound()
      Flushes the outbound of this Channel. This method is conceptually equivalent to AbstractChannel.flush().
      See Also:
    • finish

      public boolean finish()
      Mark this Channel as finished. Any further try to write data to it will fail.
      Returns:
      bufferReadable returns true if any of the used buffers has something left to read
    • finishAndReleaseAll

      public boolean finishAndReleaseAll()
      Mark this Channel as finished and release all pending message in the inbound and outbound buffer. Any further try to write data to it will fail.
      Returns:
      bufferReadable returns true if any of the used buffers has something left to read
    • releaseInbound

      public boolean releaseInbound()
      Release all buffered inbound messages and return true if any were in the inbound buffer, false otherwise.
    • releaseOutbound

      public boolean releaseOutbound()
      Release all buffered outbound messages and return true if any were in the outbound buffer, false otherwise.
    • close

      public final io.netty.channel.ChannelFuture close()
      Specified by:
      close in interface io.netty.channel.ChannelOutboundInvoker
      Overrides:
      close in class io.netty.channel.AbstractChannel
    • disconnect

      public final io.netty.channel.ChannelFuture disconnect()
      Specified by:
      disconnect in interface io.netty.channel.ChannelOutboundInvoker
      Overrides:
      disconnect in class io.netty.channel.AbstractChannel
    • close

      public final io.netty.channel.ChannelFuture close(io.netty.channel.ChannelPromise promise)
      Specified by:
      close in interface io.netty.channel.ChannelOutboundInvoker
      Overrides:
      close in class io.netty.channel.AbstractChannel
    • disconnect

      public final io.netty.channel.ChannelFuture disconnect(io.netty.channel.ChannelPromise promise)
      Specified by:
      disconnect in interface io.netty.channel.ChannelOutboundInvoker
      Overrides:
      disconnect in class io.netty.channel.AbstractChannel
    • runPendingTasks

      public void runPendingTasks()
      Run all tasks (which also includes scheduled tasks) that are pending in the EventLoop for this Channel
    • runScheduledPendingTasks

      public long runScheduledPendingTasks()
      Run all pending scheduled tasks in the EventLoop for this Channel and return the nanoseconds when the next scheduled task is ready to run. If no other task was scheduled it will return -1.
    • checkException

      public void checkException()
      Check if there was any Throwable received and if so rethrow it.
    • ensureOpen

      protected final void ensureOpen()
      Ensure the Channel is open and if not throw an exception.
    • isCompatible

      protected boolean isCompatible(io.netty.channel.EventLoop loop)
      Specified by:
      isCompatible in class io.netty.channel.AbstractChannel
    • localAddress0

      protected SocketAddress localAddress0()
      Specified by:
      localAddress0 in class io.netty.channel.AbstractChannel
    • remoteAddress0

      protected SocketAddress remoteAddress0()
      Specified by:
      remoteAddress0 in class io.netty.channel.AbstractChannel
    • doRegister

      protected void doRegister() throws Exception
      Overrides:
      doRegister in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • doBind

      protected void doBind(SocketAddress localAddress) throws Exception
      Specified by:
      doBind in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • doDisconnect

      protected void doDisconnect() throws Exception
      Specified by:
      doDisconnect in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • doClose

      protected void doClose() throws Exception
      Specified by:
      doClose in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • doBeginRead

      protected void doBeginRead() throws Exception
      Specified by:
      doBeginRead in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • newUnsafe

      protected io.netty.channel.AbstractChannel.AbstractUnsafe newUnsafe()
      Specified by:
      newUnsafe in class io.netty.channel.AbstractChannel
    • unsafe

      public io.netty.channel.Channel.Unsafe unsafe()
      Specified by:
      unsafe in interface io.netty.channel.Channel
      Overrides:
      unsafe in class io.netty.channel.AbstractChannel
    • doWrite

      protected void doWrite(io.netty.channel.ChannelOutboundBuffer in) throws Exception
      Specified by:
      doWrite in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • handleOutboundMessage

      protected void handleOutboundMessage(Object msg)
      Called for each outbound message.
      See Also:
    • handleInboundMessage

      protected void handleInboundMessage(Object msg)
      Called for each inbound message.