Package zmq.io

Class StreamEngine

java.lang.Object
zmq.io.StreamEngine
All Implemented Interfaces:
IEngine, IPollEvents

public class StreamEngine extends Object implements IEngine, IPollEvents
  • Field Details

    • ioObject

      private IOObject ioObject
    • fd

      private SocketChannel fd
    • handle

      private Poller.Handle handle
    • inpos

      private ByteBuffer inpos
    • insize

      private int insize
    • decoder

      private IDecoder decoder
    • outpos

      private final ValueReference<ByteBuffer> outpos
    • outsize

      private int outsize
    • encoder

      private IEncoder encoder
    • metadata

      private Metadata metadata
    • handshaking

      private boolean handshaking
    • SIGNATURE_SIZE

      private static final int SIGNATURE_SIZE
      See Also:
    • V2_GREETING_SIZE

      private static final int V2_GREETING_SIZE
      See Also:
    • V3_GREETING_SIZE

      private static final int V3_GREETING_SIZE
      See Also:
    • greetingSize

      private int greetingSize
    • greetingRecv

      private final ByteBuffer greetingRecv
    • greetingSend

      private final ByteBuffer greetingSend
    • zmtpVersion

      private StreamEngine.Protocol zmtpVersion
    • session

      private SessionBase session
    • options

      private final Options options
    • endpoint

      private final String endpoint
    • plugged

      private boolean plugged
    • nextMsg

      private Supplier<Msg> nextMsg
    • processMsg

      private Function<Msg,Boolean> processMsg
    • ioError

      private boolean ioError
    • subscriptionRequired

      private boolean subscriptionRequired
    • mechanism

      private Mechanism mechanism
    • inputStopped

      private boolean inputStopped
    • outputStopped

      private boolean outputStopped
    • HANDSHAKE_TIMER_ID

      private static final int HANDSHAKE_TIMER_ID
      See Also:
    • HEARTBEAT_TTL_TIMER_ID

      private static final int HEARTBEAT_TTL_TIMER_ID
      See Also:
    • HEARTBEAT_IVL_TIMER_ID

      private static final int HEARTBEAT_IVL_TIMER_ID
      See Also:
    • HEARTBEAT_TIMEOUT_TIMER_ID

      private static final int HEARTBEAT_TIMEOUT_TIMER_ID
      See Also:
    • hasHandshakeTimer

      private boolean hasHandshakeTimer
    • hasTtlTimer

      private boolean hasTtlTimer
    • hasTimeoutTimer

      private boolean hasTimeoutTimer
    • hasHeartbeatTimer

      private boolean hasHeartbeatTimer
    • heartbeatTimeout

      private final int heartbeatTimeout
    • heartbeatContext

      private final byte[] heartbeatContext
    • socket

      private SocketBase socket
    • peerAddress

      private final Address peerAddress
    • errno

      private final Errno errno
    • processIdentity

      private final Function<Msg,Boolean> processIdentity
    • nextIdentity

      private final Supplier<Msg> nextIdentity
    • processHandshakeCommand

      private final Function<Msg,Boolean> processHandshakeCommand
    • nextHandshakeCommand

      private final Supplier<Msg> nextHandshakeCommand
    • pushMsgToSession

      private final Function<Msg,Boolean> pushMsgToSession
    • pullMsgFromSession

      private final Supplier<Msg> pullMsgFromSession
    • pushRawMsgToSession

      private final Function<Msg,Boolean> pushRawMsgToSession
    • writeCredential

      private final Function<Msg,Boolean> writeCredential
    • pullAndEncode

      private final Supplier<Msg> pullAndEncode
    • decodeAndPush

      private final Function<Msg,Boolean> decodeAndPush
    • pushOneThenDecodeAndPush

      private final Function<Msg,Boolean> pushOneThenDecodeAndPush
    • producePingMessage

      private final Supplier<Msg> producePingMessage
  • Constructor Details

  • Method Details

    • heartbeatTimeout

      private int heartbeatTimeout()
    • destroy

      public void destroy()
    • plug

      public void plug(IOThread ioThread, SessionBase session)
      Specified by:
      plug in interface IEngine
    • instantiate

      private <T> T instantiate(Class<T> clazz, int size, long max)
    • unplug

      private void unplug()
    • terminate

      public void terminate()
      Specified by:
      terminate in interface IEngine
    • inEvent

      public void inEvent()
      Description copied from interface: IPollEvents
      Called by I/O thread when file descriptor is ready for reading.
      Specified by:
      inEvent in interface IPollEvents
    • outEvent

      public void outEvent()
      Description copied from interface: IPollEvents
      Called by I/O thread when file descriptor is ready for writing.
      Specified by:
      outEvent in interface IPollEvents
    • restartOutput

      public void restartOutput()
      Specified by:
      restartOutput in interface IEngine
    • restartInput

      public void restartInput()
      Specified by:
      restartInput in interface IEngine
    • decodeCurrentInputs

      private boolean decodeCurrentInputs()
    • handshake

      private boolean handshake()
    • decodeDataAfterHandshake

      private void decodeDataAfterHandshake(int greetingSize)
    • identityMsg

      private Msg identityMsg()
    • processIdentityMsg

      private boolean processIdentityMsg(Msg msg)
    • nextHandshakeCommand

      private Msg nextHandshakeCommand()
    • processHandshakeCommand

      private boolean processHandshakeCommand(Msg msg)
    • zapMsgAvailable

      public void zapMsgAvailable()
      Specified by:
      zapMsgAvailable in interface IEngine
    • mechanismReady

      private void mechanismReady()
    • pullMsgFromSession

      private Msg pullMsgFromSession()
    • pushMsgToSession

      private boolean pushMsgToSession(Msg msg)
    • pushRawMsgToSession

      private boolean pushRawMsgToSession(Msg msg)
    • writeCredential

      private boolean writeCredential(Msg msg)
    • pullAndEncode

      private Msg pullAndEncode()
    • decodeAndPush

      private boolean decodeAndPush(Msg msg)
    • pushOneThenDecodeAndPush

      private boolean pushOneThenDecodeAndPush(Msg msg)
    • error

      private void error(StreamEngine.ErrorReason error)
    • setHandshakeTimer

      private void setHandshakeTimer()
    • timerEvent

      public void timerEvent(int id)
      Description copied from interface: IPollEvents
      Called when timer expires.
      Specified by:
      timerEvent in interface IPollEvents
      Parameters:
      id - the ID of the expired timer.
    • producePingMessage

      private Msg producePingMessage()
    • producePongMessage

      private Msg producePongMessage(byte[] pingContext)
    • processCommand

      private boolean processCommand(Msg msg)
    • processHeartbeatMessage

      private boolean processHeartbeatMessage(Msg msg)
    • write

      private int write(ByteBuffer outbuf)
    • read

      private int read(ByteBuffer buf)
    • toString

      public String toString()
      Overrides:
      toString in class Object