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 long
deserialize_req
protected long
deserialize_rsp
protected long
receive_req
protected long
rsp_dispatched
static short
RTT_ID
protected long
send_req
protected long
send_rsp
protected long
serialize_req
protected long
serialize_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 interfaceRTTHeader
deserialize(long nanos)
long
downRequest()
Time to send a request down, from sending until just before serializationshort
getMagicId()
Returns the magic-ID.long
networkRequest()
The time the request has spent on the network, between serializing it at the caller and de-serializing it at the receiverlong
networkResponse()
The time a response has spent on the network, between serializing the response and de-serializing itprotected static java.lang.String
print(long r)
long
processingTime()
Time between reception of a message and sending of a response (= time spent in application code)void
readFrom(java.io.DataInput in)
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedRTTHeader
receiveReq(long nanos)
RTTHeader
rspDispatched(long nanos)
RTTHeader
sendReq(long nanos)
RTTHeader
sendRsp(long nanos)
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_req
is 0: if so we set it, otherwise we setserialize_rsp
instead.int
serializedSize()
Returns the size (in bytes) of the marshalled objectjava.lang.String
toString()
long
totalTime()
The total time for a round-triplong
upReq()
The time after deserializing a request until before it is dispatched to the applicationlong
upRsp()
The time between deserialization of a response and after dispatching to the applicationvoid
writeTo(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: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 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_req
is 0: if so we set it, otherwise we setserialize_rsp
instead.
-
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:SizeStreamable
Returns the size (in bytes) of the marshalled object
-
writeTo
public void writeTo(java.io.DataOutput out) throws java.io.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:
java.io.IOException
-
readFrom
public void readFrom(java.io.DataInput in) throws java.io.IOException, java.lang.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:
java.io.IOException
java.lang.ClassNotFoundException
-
print
protected static java.lang.String print(long r)
-
-