Package bftsmart.tom

Class 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.
    • 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-SMART
        replyComparator - Used for comparing replies from different servers to extract one returned by f+1
        replyExtractor - Used for extracting the response from the matching quorum of replies
        loader - 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 sent
        targets - The IDs for the replicas to which to send the request
        replyListener - Callback object that handles reception of replies
        reqType - 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 interface ReplyReceiver
        Overrides:
        replyReceived in class ServiceProxy
        Parameters:
        reply - The reply delivered by the client side communication system