Class BIONetworkLayer

java.lang.Object
org.jenkinsci.remoting.protocol.NetworkLayer
org.jenkinsci.remoting.protocol.impl.BIONetworkLayer
All Implemented Interfaces:
ProtocolLayer, ProtocolLayer.Send

public class BIONetworkLayer extends NetworkLayer
A NetworkLayer that uses a dedicated reader thread and runs on demand writer thread to manage I/O.
Since:
3.0
  • Constructor Details

  • Method Details

    • write

      protected void write(@NonNull ByteBuffer data) throws IOException
      SPI: Perform the actual write to the recipient. This method should be non-blocking. The data should be enqueued and written in the order of calls to write()}.
      Specified by:
      write in class NetworkLayer
      Parameters:
      data - the data received. Any data consumed from the ByteBuffer can be assumed as processed. Any data not consumed from the ByteBuffer will be the responsibility of the caller to resubmit in subsequent calls.
      Throws:
      IOException - if something goes wrong
    • doCloseRecv

      public void doCloseRecv()
      Request the recv side to be closed.
      Specified by:
      doCloseRecv in class NetworkLayer
    • start

      public void start() throws IOException
      Starts this layer. All layers in the stack will be initialized before a call to this method. All lower layers in the stack will have been started before this layer is started.
      Specified by:
      start in interface ProtocolLayer
      Overrides:
      start in class NetworkLayer
      Throws:
      IOException - if something goes wrong.
    • doCloseSend

      public void doCloseSend() throws IOException
      Notify the lower layer that it should close. Callers to this method are assumed to have already called ProtocolLayer.Recv.onRecvClosed(IOException) for any upper layers.
      Throws:
      IOException - if there was an error closing the lower layer.
    • isSendOpen

      public boolean isSendOpen()
      Tracks if this layer is submitting data to be sent via ProtocolLayer.Send.doSend(ByteBuffer). Once this method returns false it must always return false and can be assumed to behave in this way.
      Returns:
      true if submitting data to be sent via ProtocolLayer.Send.doSend(ByteBuffer).