public class DefaultAppRequest extends java.lang.Object implements ReplicableRequest, ReconfigurableRequest
Modifier and Type | Class and Description |
---|---|
protected static class |
DefaultAppRequest.Keys |
STOP
Constructor and Description |
---|
DefaultAppRequest(org.json.JSONObject json) |
DefaultAppRequest(java.lang.String serviceName,
int epochNumber,
boolean stop) |
Modifier and Type | Method and Description |
---|---|
int |
getEpochNumber() |
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. |
IntegerPacketType |
getRequestType() |
java.lang.String |
getServiceName() |
boolean |
isStop() |
boolean |
needsCoordination() |
void |
setNeedsCoordination(boolean b)
After this method returns,
ReplicableRequest.needsCoordination() should
subsequently return b . |
org.json.JSONObject |
toJSONObject() |
java.lang.String |
toString()
Serializes the request to a String.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSummary
getSummary
public DefaultAppRequest(java.lang.String serviceName, int epochNumber, boolean stop)
serviceName
- epochNumber
- stop
- public DefaultAppRequest(org.json.JSONObject json) throws org.json.JSONException
json
- org.json.JSONException
public IntegerPacketType getRequestType()
getRequestType
in interface Request
public java.lang.String getServiceName()
getServiceName
in interface Request
public java.lang.String toString()
Request
public org.json.JSONObject toJSONObject() throws org.json.JSONException
org.json.JSONException
public int getEpochNumber()
getEpochNumber
in interface ReconfigurableRequest
public boolean isStop()
isStop
in interface ReconfigurableRequest
public boolean needsCoordination()
needsCoordination
in interface ReplicableRequest
public void setNeedsCoordination(boolean b)
ReplicableRequest
ReplicableRequest.needsCoordination()
should
subsequently return b
. This method is invoked by
AbstractReplicaCoordinator
with a false
argument just
before coordinating the request so that coordinated packets are not
coordinated again infinitely. For example, if a replica coordinator's
coordination strategy is to simply flood the request to all replicas,
there needs to be a way for a recipient of a copy of this already once
coordinated request to know that it should not coordinate it again. This
method provides AbstractReplicaCoordinator
a placeholder in the
application request to prevent such infinite coordination loops.
This method is now deprecated and does not need to be overridden by implementing classes. It's original purpose was really only to be able to easily do lazy propagation replica coordination without introducing an additional type (just to distinguish between the original request at the entry replica and the replicated request so as to avoid an infinite propagation loop), but introducing an additional type is the clean way to do this. Paxos for example already has its own types, so it doesn't need this method.
setNeedsCoordination
in interface ReplicableRequest
b
- True if subsequent invocations of ReplicableRequest.needsCoordination()
must return true, false otherwise.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