Class SendBuffer

java.lang.Object
services.moleculer.transporter.tcp.SendBuffer

public class SendBuffer extends Object
Attachment of TcpWriter's SelectionKeys.
  • Field Details

  • Constructor Details

    • SendBuffer

      protected SendBuffer(String nodeID, String host, int port, boolean debug)
  • Method Details

    • connected

      protected void connected(SelectionKey key, SocketChannel channel)
    • append

      protected boolean append(byte[] packet)
      Adds a packet to the buffer's queue.
      Parameters:
      packet - packet to write
      Returns:
      true, if success (false = buffer is closed)
    • tryToClose

      protected boolean tryToClose()
      Tries to close this buffer.
      Returns:
      true, is closed (false = buffer is not empty)
    • close

      protected void close()
    • closeResources

      protected void closeResources()
    • write

      protected void write() throws Exception
      Writes N bytes to the target channel.
      Throws:
      Exception - any I/O exception
    • getUnsentPackets

      public LinkedList<byte[]> getUnsentPackets()