Class RTTHeader

java.lang.Object
org.jgroups.Header
org.jgroups.protocols.RTTHeader
All Implemented Interfaces:
Constructable<Header>, SizeStreamable, Streamable

public class RTTHeader extends Header
Header to measure round-trip times (in nanoseconds) for sync RPCs (https://issues.redhat.com/browse/JGRP-2604)
Since:
5.2.1
  • Field Details

    • RTT_ID

      public static final short RTT_ID
      See Also:
    • send_req

      protected long send_req
    • serialize_req

      protected long serialize_req
    • deserialize_req

      protected long deserialize_req
    • receive_req

      protected long receive_req
    • send_rsp

      protected long send_rsp
    • serialize_rsp

      protected long serialize_rsp
    • deserialize_rsp

      protected long deserialize_rsp
    • rsp_dispatched

      protected long rsp_dispatched
  • Constructor Details

    • RTTHeader

      public RTTHeader()
  • Method Details

    • create

      public Supplier<? extends Header> create()
      Description copied from interface: Constructable
      Creates an instance of the class implementing this interface
    • getMagicId

      public short getMagicId()
      Description copied from class: Header
      Returns the magic-ID. If defined in jg-magic-map.xml, the IDs need to be the same
      Specified by:
      getMagicId in class Header
    • sendReq

      public RTTHeader sendReq(long nanos)
    • serialize

      public RTTHeader serialize(long nanos)
      Since we don't know whether we're serializing a request or a response, the following happens: since the request is serialized _before_ the response, we check if serialize_req is 0: if so we set it, otherwise we set serialize_rsp instead.
    • deserialize

      public RTTHeader deserialize(long nanos)
      Sets either deserialize_req or deserialize_rsp; same logic as serialize(long).
    • receiveReq

      public RTTHeader receiveReq(long nanos)
    • sendRsp

      public RTTHeader sendRsp(long nanos)
    • rspDispatched

      public RTTHeader rspDispatched(long nanos)
    • totalTime

      public long totalTime()
      The total time for a round-trip
    • downRequest

      public long downRequest()
      Time to send a request down, from sending until just before serialization
    • networkRequest

      public long networkRequest()
      The time the request has spent on the network, between serializing it at the caller and de-serializing it at the receiver
    • upReq

      public long upReq()
      The time after deserializing a request until before it is dispatched to the application
    • upRsp

      public long upRsp()
      The time between deserialization of a response and after dispatching to the application
    • processingTime

      public long processingTime()
      Time between reception of a message and sending of a response (= time spent in application code)
    • networkResponse

      public long networkResponse()
      The time a response has spent on the network, between serializing the response and de-serializing it
    • toString

      public String toString()
      Overrides:
      toString in class Header
    • serializedSize

      public int serializedSize()
      Description copied from interface: SizeStreamable
      Returns the size (in bytes) of the marshalled object
    • writeTo

      public void writeTo(DataOutput out) throws IOException
      Description copied from interface: Streamable
      Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
      Throws:
      IOException
    • readFrom

      public void readFrom(DataInput in) throws IOException, ClassNotFoundException
      Description copied from interface: Streamable
      Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
      Throws:
      IOException
      ClassNotFoundException
    • print

      protected static String print(long r)