Class TerminateDriverFlyweight

java.lang.Object
io.aeron.command.CorrelatedMessageFlyweight
io.aeron.command.TerminateDriverFlyweight

public class TerminateDriverFlyweight extends CorrelatedMessageFlyweight
Command message flyweight to ask the driver process to terminate.
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                          Client ID                            |
  |                                                               |
  +---------------------------------------------------------------+
  |                        Correlation ID                         |
  |                                                               |
  +---------------------------------------------------------------+
  |                         Token Length                          |
  +---------------------------------------------------------------+
  |                         Token Buffer                         ...
 ...                                                              |
  +---------------------------------------------------------------+
 
See Also:
  • Constructor Details

    • TerminateDriverFlyweight

      public TerminateDriverFlyweight()
  • Method Details

    • wrap

      public TerminateDriverFlyweight wrap(MutableDirectBuffer buffer, int offset)
      Wrap the buffer at a given offset for updates.
      Overrides:
      wrap in class CorrelatedMessageFlyweight
      Parameters:
      buffer - to wrap.
      offset - at which the message begins.
      Returns:
      this for a fluent API.
    • tokenBufferOffset

      public int tokenBufferOffset()
      Relative offset of the token buffer.
      Returns:
      relative offset of the token buffer.
    • tokenBufferLength

      public int tokenBufferLength()
      Length of the token buffer in bytes.
      Returns:
      length of token buffer in bytes.
    • tokenBuffer

      public TerminateDriverFlyweight tokenBuffer(DirectBuffer tokenBuffer, int tokenOffset, int tokenLength)
      Fill the token buffer.
      Parameters:
      tokenBuffer - containing the optional token for the request.
      tokenOffset - within the tokenBuffer at which the token begins.
      tokenLength - of the token in the tokenBuffer.
      Returns:
      this for a fluent API.
    • length

      public int length()
      Get the length of the current message.

      NB: must be called after the data is written in order to be correct.

      Returns:
      the length of the current message
    • validateLength

      public void validateLength(int msgTypeId, int length)
      Validate buffer length is long enough for message.
      Overrides:
      validateLength in class CorrelatedMessageFlyweight
      Parameters:
      msgTypeId - type of message.
      length - of message in bytes to validate.
    • computeLength

      public static int computeLength(int tokenLength)
      Compute the length of the command message for a given token length.
      Parameters:
      tokenLength - to be appended to the header.
      Returns:
      the length of the command message for a given token length.