Package bftsmart.tom.client
Class AbstractRequestHandler
- java.lang.Object
-
- bftsmart.tom.client.AbstractRequestHandler
-
- Direct Known Subclasses:
HashedRequestHandler,NormalRequestHandler
public abstract class AbstractRequestHandler extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerloggerprotected intmeprotected intoperationIdprotected TOMMessage[]repliesprotected intreplyQuorumSizeprotected java.util.Set<java.lang.Integer>replySendersprotected TOMMessageTyperequestTypeprotected intsequenceIdprotected intsessionprotected intviewId
-
Constructor Summary
Constructors Constructor Description AbstractRequestHandler(int me, int session, int sequenceId, int operationId, int viewId, TOMMessageType requestType, int timeout, int[] replicas, int replyQuorumSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract TOMMessagecreateRequest(byte[] request)intgetNumberReceivedReplies()intgetReplyQuorumSize()TOMMessagegetResponse()This method returns the response.intgetSequenceId()booleanisRequestTimeout()Call this method after calling waitForResponse().abstract voidprintState()voidprocessReply(TOMMessage reply)abstract TOMMessageprocessReply(TOMMessage reply, int lastSenderIndex)voidwaitForResponse()
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
me
protected final int me
-
session
protected final int session
-
sequenceId
protected final int sequenceId
-
operationId
protected final int operationId
-
viewId
protected final int viewId
-
requestType
protected final TOMMessageType requestType
-
replies
protected final TOMMessage[] replies
-
replyQuorumSize
protected final int replyQuorumSize
-
replySenders
protected java.util.Set<java.lang.Integer> replySenders
-
-
Constructor Detail
-
AbstractRequestHandler
public AbstractRequestHandler(int me, int session, int sequenceId, int operationId, int viewId, TOMMessageType requestType, int timeout, int[] replicas, int replyQuorumSize)
-
-
Method Detail
-
createRequest
public abstract TOMMessage createRequest(byte[] request)
-
waitForResponse
public void waitForResponse() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
getResponse
public TOMMessage getResponse()
This method returns the response. Call this method after calling waitForResponse() method.- Returns:
- Response to the request
-
processReply
public void processReply(TOMMessage reply)
-
processReply
public abstract TOMMessage processReply(TOMMessage reply, int lastSenderIndex)
-
getSequenceId
public int getSequenceId()
-
getNumberReceivedReplies
public int getNumberReceivedReplies()
-
getReplyQuorumSize
public int getReplyQuorumSize()
-
isRequestTimeout
public boolean isRequestTimeout()
Call this method after calling waitForResponse().- Returns:
- true if request timeout or false otherwise.
-
printState
public abstract void printState()
-
-