Package bftsmart.tom

Class ServiceReplica


  • public class ServiceReplica
    extends java.lang.Object
    This class receives messages from DeliveryThread and manages the execution from the application and reply to the clients. For applications where the ordered messages are executed one by one, ServiceReplica receives the batch decided in a consensus, deliver one by one and reply with the batch of replies. In cases where the application executes the messages in batches, the batch of messages is delivered to the application and ServiceReplica doesn't need to organize the replies in batches.
    • Constructor Detail

      • ServiceReplica

        public ServiceReplica​(int id,
                              Executable executor,
                              Recoverable recoverer)
        Constructor
        Parameters:
        id - Replica ID
        executor - Executor
        recoverer - Recoverer
      • ServiceReplica

        public ServiceReplica​(int id,
                              Executable executor,
                              Recoverable recoverer,
                              RequestVerifier verifier)
        Constructor
        Parameters:
        id - Replica ID
        executor - Executor
        recoverer - Recoverer
        verifier - Requests verifier
      • ServiceReplica

        public ServiceReplica​(int id,
                              java.lang.String configHome,
                              Executable executor,
                              Recoverable recoverer,
                              RequestVerifier verifier,
                              Replier replier,
                              KeyLoader loader)
        Constructor
        Parameters:
        id - Replica ID
        configHome - Configuration directory for BFT-SMART
        executor - The executor implementation
        recoverer - The recoverer implementation
        verifier - Requests Verifier
        replier - Can be used to override the targets of the replies associated to each request.
        loader - Used to load signature keys from disk
    • Method Detail

      • joinMsgReceived

        public void joinMsgReceived​(VMMessage msg)
      • kill

        public void kill()
        Stops the service execution at a replica. It will shutdown all threads, stop the requests' timer, and drop all enqueued requests, thus letting the ServiceReplica object be garbage-collected. From the perspective of the rest of the system, this is equivalent to a simple crash fault.
      • restart

        public void restart()
        Cleans the object state and reboots execution. From the perspective of the rest of the system, this is equivalent to a rash followed by a recovery.
      • receiveMessages

        public void receiveMessages​(int[] consId,
                                    int[] regencies,
                                    int[] leaders,
                                    CertifiedDecision[] cDecs,
                                    TOMMessage[][] requests)
      • getReplicaContext

        public final ReplicaContext getReplicaContext()
        Obtains the current replica context (getting access to several information and capabilities of the replication engine).
        Returns:
        this replica context
      • getServerCommunicationSystem

        public ServerCommunicationSystem getServerCommunicationSystem()
        Obtains the current replica communication system.
        Returns:
        The replica's communication system
      • getId

        public int getId()
        Replica ID
        Returns:
        Replica ID