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.Logger
logger
protected int
me
protected int
operationId
protected TOMMessage[]
replies
protected int
replyQuorumSize
protected java.util.Set<java.lang.Integer>
replySenders
protected TOMMessageType
requestType
protected int
sequenceId
protected int
session
protected int
viewId
-
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 TOMMessage
createRequest(byte[] request)
int
getNumberReceivedReplies()
int
getReplyQuorumSize()
TOMMessage
getResponse()
This method returns the response.int
getSequenceId()
boolean
isRequestTimeout()
Call this method after calling waitForResponse().abstract void
printState()
void
processReply(TOMMessage reply)
abstract TOMMessage
processReply(TOMMessage reply, int lastSenderIndex)
void
waitForResponse()
-
-
-
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()
-
-