public class EchoRequest extends BasicReconfigurationPacket<java.net.InetSocketAddress> implements ClientRequest
ReconfigurationPacket.PacketType
Modifier and Type | Field and Description |
---|---|
java.net.InetSocketAddress |
myReceiver |
long |
requestID |
long |
sentTime |
epochNumber, serviceName
clientPacketTypes, HANDLER_METHOD_PREFIX, PACKET_TYPE, serverPacketTypes
type
Constructor and Description |
---|
EchoRequest(java.net.InetSocketAddress initiator) |
EchoRequest(java.net.InetSocketAddress initiator,
java.util.Map<java.net.InetAddress,java.lang.Long> closest) |
EchoRequest(org.json.JSONObject json) |
EchoRequest(org.json.JSONObject json,
Stringifiable<?> unstringer) |
Modifier and Type | Method and Description |
---|---|
java.net.InetSocketAddress |
getClientAddress() |
java.util.Map<java.net.InetAddress,java.lang.Long> |
getClosest() |
long |
getRequestID()
The uniqueness of this identifier across all requests to a replica group
is important for safety when
PaxosConfig.PC.PREVENT_DOUBLE_EXECUTION is
enabled as gigapaxos may otherwise assume that the duplicate request
identifier corresponds to a retransmission and will send back the
response if any corresponding to the first execution. |
ClientRequest |
getResponse() |
java.lang.String |
getSummary()
Implementations are encouraged to return an inline created new Object()
whose toString() method will return the actual String instead of just
returning the String directly.
|
boolean |
hasClosest() |
boolean |
isRequest() |
EchoRequest |
makeResponse(java.net.InetSocketAddress address) |
org.json.JSONObject |
toJSONObjectImpl() |
getEpochNumber, getRequestType, getServiceName
assertPacketTypeChecks, assertPacketTypeChecks, assertPacketTypeChecks, assertPacketTypeChecks, concatenate, getMessage, getPacketType, getPacketTypeCanonicalClassName, getPacketTypeClass, getPacketTypeClassName, getReconfigurationPacket, getReconfigurationPacket, getReconfigurationPacketSuppressExceptions, getReconfigurationPacketSuppressExceptions, getReconfigurationPacketType, getReconfigurationPacketType, isReconfigurationPacket, putPacketType, toBytes, toString
flip, getInitiator, getKey, getSender, getType, setKey, setSender, setType, toJSONObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRequestType, getServiceName, toBytes, toString
getSummary
public final long requestID
public final long sentTime
public final java.net.InetSocketAddress myReceiver
public EchoRequest(java.net.InetSocketAddress initiator, java.util.Map<java.net.InetAddress,java.lang.Long> closest)
initiator
- closest
- public EchoRequest(java.net.InetSocketAddress initiator)
initiator
- public EchoRequest(org.json.JSONObject json, Stringifiable<?> unstringer) throws org.json.JSONException, java.net.UnknownHostException
json
- unstringer
- org.json.JSONException
java.net.UnknownHostException
public EchoRequest(org.json.JSONObject json) throws org.json.JSONException, java.net.UnknownHostException
json
- org.json.JSONException
java.net.UnknownHostException
public org.json.JSONObject toJSONObjectImpl() throws org.json.JSONException
toJSONObjectImpl
in class BasicReconfigurationPacket<java.net.InetSocketAddress>
org.json.JSONException
public boolean isRequest()
public long getRequestID()
RequestIdentifier
PaxosConfig.PC.PREVENT_DOUBLE_EXECUTION
is
enabled as gigapaxos may otherwise assume that the duplicate request
identifier corresponds to a retransmission and will send back the
response if any corresponding to the first execution. With
PaxosConfig.PC.PREVENT_DOUBLE_EXECUTION
disabled, the uniqueness is important for liveness as duplicate request
identifiers may result in the client not receiving a response for the
latter request; this is because gigapaxos stores request execution
callbacks indexed by the request identifier, so there must be at most one
outstanding request with a given identifier for a given replica group.getRequestID
in interface RequestIdentifier
public java.net.InetSocketAddress getClientAddress()
getClientAddress
in interface ClientRequest
AbstractReplicaCoordinator
already knows the sending client's
address anyway.public ClientRequest getResponse()
getResponse
in interface ClientRequest
AbstractReplicaCoordinator
, e.g.,
PaxosManager
, will invoke this method immediately after
Application.execute(Request)
and, if the returned response
is non-null, will send it back to the client that issued that
request. Applications are expected to internally implement logic
that sets the response at the end of
Application.execute(Request)
as follows:
public boolean Replicable
.execute(Request request)} {
// execute request to obtain response
request.setResponse(response);
}
public boolean hasClosest()
public EchoRequest makeResponse(java.net.InetSocketAddress address)
address
- this
.public java.lang.String getSummary()
Summarizable
getSummary
in interface Request
getSummary
in interface Summarizable
getSummary
in class BasicReconfigurationPacket<java.net.InetSocketAddress>
public java.util.Map<java.net.InetAddress,java.lang.Long> getClosest()