Package org.jgroups.protocols
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
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected longdeserialize_reqprotected longdeserialize_rspprotected longreceive_reqprotected longrsp_dispatchedstatic shortRTT_IDprotected longsend_reqprotected longsend_rspprotected longserialize_reqprotected longserialize_rsp
-
Constructor Summary
Constructors Constructor Description RTTHeader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Supplier<? extends Header>create()Creates an instance of the class implementing this interfaceRTTHeaderdeserialize(long nanos)longdownRequest()Time to send a request down, from sending until just before serializationshortgetMagicId()Returns the magic-ID.longnetworkRequest()The time the request has spent on the network, between serializing it at the caller and de-serializing it at the receiverlongnetworkResponse()The time a response has spent on the network, between serializing the response and de-serializing itprotected static java.lang.Stringprint(long r)longprocessingTime()Time between reception of a message and sending of a response (= time spent in application code)voidreadFrom(java.io.DataInput in)Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedRTTHeaderreceiveReq(long nanos)RTTHeaderrspDispatched(long nanos)RTTHeadersendReq(long nanos)RTTHeadersendRsp(long nanos)RTTHeaderserialize(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 ifserialize_reqis 0: if so we set it, otherwise we setserialize_rspinstead.intserializedSize()Returns the size (in bytes) of the marshalled objectjava.lang.StringtoString()longtotalTime()The total time for a round-triplongupReq()The time after deserializing a request until before it is dispatched to the applicationlongupRsp()The time between deserialization of a response and after dispatching to the applicationvoidwriteTo(java.io.DataOutput out)Write the entire state of the current object (including superclasses) to outstream.
-
-
-
Field Detail
-
RTT_ID
public static final short RTT_ID
- See Also:
- Constant Field Values
-
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
-
-
Method Detail
-
create
public java.util.function.Supplier<? extends Header> create()
Description copied from interface:ConstructableCreates an instance of the class implementing this interface
-
getMagicId
public short getMagicId()
Description copied from class:HeaderReturns the magic-ID. If defined in jg-magic-map.xml, the IDs need to be the same- Specified by:
getMagicIdin classHeader
-
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 ifserialize_reqis 0: if so we set it, otherwise we setserialize_rspinstead.
-
deserialize
public RTTHeader deserialize(long nanos)
-
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
-
serializedSize
public int serializedSize()
Description copied from interface:SizeStreamableReturns the size (in bytes) of the marshalled object
-
writeTo
public void writeTo(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from interface:StreamableWrite the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed- Throws:
java.io.IOException
-
readFrom
public void readFrom(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionDescription copied from interface:StreamableRead the state of the current object (including superclasses) from instream Note that the input stream must not be closed- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
print
protected static java.lang.String print(long r)
-
-