Package bftsmart.tom
Class AsynchServiceProxy
- java.lang.Object
-
- bftsmart.tom.core.TOMSender
-
- bftsmart.tom.ServiceProxy
-
- bftsmart.tom.AsynchServiceProxy
-
- All Implemented Interfaces:
ReplyReceiver
,java.io.Closeable
,java.lang.AutoCloseable
public class AsynchServiceProxy extends ServiceProxy
This class is an extension of 'ServiceProxy' that can waits for replies asynchronously.
-
-
Field Summary
-
Fields inherited from class bftsmart.tom.ServiceProxy
canReceiveLock, canSendLock
-
-
Constructor Summary
Constructors Constructor Description AsynchServiceProxy(int processId)
ConstructorAsynchServiceProxy(int processId, java.lang.String configHome)
ConstructorAsynchServiceProxy(int processId, java.lang.String configHome, KeyLoader loader)
ConstructorAsynchServiceProxy(int processId, java.lang.String configHome, java.util.Comparator<byte[]> replyComparator, Extractor replyExtractor, KeyLoader loader)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanAsynchRequest(int requestId)
Purges all information associated to the request.int
invokeAsynchRequest(byte[] request, int[] targets, ReplyListener replyListener, TOMMessageType reqType)
This method asynchronously sends a request to the replicas.int
invokeAsynchRequest(byte[] request, ReplyListener replyListener, TOMMessageType reqType)
void
replyReceived(TOMMessage reply)
This is the method invoked by the client side communication system.-
Methods inherited from class bftsmart.tom.ServiceProxy
getInvokeTimeout, getInvokeUnorderedHashedTimeout, invoke, invokeOrdered, invokeOrderedHashed, invokeUnordered, invokeUnorderedHashed, reconfigureTo, setInvokeTimeout, setInvokeUnorderedHashedTimeout
-
Methods inherited from class bftsmart.tom.core.TOMSender
close, generateOperationId, generateRequestId, getCommunicationSystem, getProcessId, getReplyQuorum, getSession, getViewManager, sendMessageToTargets, TOMulticast, TOMulticast
-
-
-
-
Constructor Detail
-
AsynchServiceProxy
public AsynchServiceProxy(int processId)
Constructor- See Also:
bellow
-
AsynchServiceProxy
public AsynchServiceProxy(int processId, java.lang.String configHome)
Constructor- See Also:
bellow
-
AsynchServiceProxy
public AsynchServiceProxy(int processId, java.lang.String configHome, KeyLoader loader)
Constructor- See Also:
bellow
-
AsynchServiceProxy
public AsynchServiceProxy(int processId, java.lang.String configHome, java.util.Comparator<byte[]> replyComparator, Extractor replyExtractor, KeyLoader loader)
Constructor- Parameters:
processId
- Process id for this client (should be different from replicas)configHome
- Configuration directory for BFT-SMARTreplyComparator
- Used for comparing replies from different servers to extract one returned by f+1replyExtractor
- Used for extracting the response from the matching quorum of repliesloader
- Used to load signature keys from disk
-
-
Method Detail
-
invokeAsynchRequest
public int invokeAsynchRequest(byte[] request, ReplyListener replyListener, TOMMessageType reqType)
- See Also:
bellow
-
invokeAsynchRequest
public int invokeAsynchRequest(byte[] request, int[] targets, ReplyListener replyListener, TOMMessageType reqType)
This method asynchronously sends a request to the replicas.- Parameters:
request
- Request to be senttargets
- The IDs for the replicas to which to send the requestreplyListener
- Callback object that handles reception of repliesreqType
- Request type- Returns:
- A unique identification for the request
-
cleanAsynchRequest
public void cleanAsynchRequest(int requestId)
Purges all information associated to the request. This should always be invoked once enough replies are received and processed by the ReplyListener callback.- Parameters:
requestId
- A unique identification for a previously sent request
-
replyReceived
public void replyReceived(TOMMessage reply)
This is the method invoked by the client side communication system.- Specified by:
replyReceived
in interfaceReplyReceiver
- Overrides:
replyReceived
in classServiceProxy
- Parameters:
reply
- The reply delivered by the client side communication system
-
-