Package bftsmart.tom
Class ServiceReplica
- java.lang.Object
-
- bftsmart.tom.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 Summary
Constructors Constructor Description ServiceReplica(int id, Executable executor, Recoverable recoverer)
ConstructorServiceReplica(int id, Executable executor, Recoverable recoverer, RequestVerifier verifier)
ConstructorServiceReplica(int id, Executable executor, Recoverable recoverer, RequestVerifier verifier, Replier replier)
ConstructorServiceReplica(int id, Executable executor, Recoverable recoverer, RequestVerifier verifier, Replier replier, KeyLoader loader, java.security.Provider provider)
ConstructorServiceReplica(int id, java.lang.String configHome, Executable executor, Recoverable recoverer, RequestVerifier verifier, Replier replier, KeyLoader loader)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getId()
Replica IDReplicaContext
getReplicaContext()
Obtains the current replica context (getting access to several information and capabilities of the replication engine).ServerCommunicationSystem
getServerCommunicationSystem()
Obtains the current replica communication system.void
joinMsgReceived(VMMessage msg)
void
kill()
Stops the service execution at a replica.void
receiveMessages(int[] consId, int[] regencies, int[] leaders, CertifiedDecision[] cDecs, TOMMessage[][] requests)
void
receiveReadonlyMessage(TOMMessage message, MessageContext msgCtx)
void
restart()
Cleans the object state and reboots execution.
-
-
-
Constructor Detail
-
ServiceReplica
public ServiceReplica(int id, Executable executor, Recoverable recoverer)
Constructor- Parameters:
id
- Replica IDexecutor
- Executorrecoverer
- Recoverer
-
ServiceReplica
public ServiceReplica(int id, Executable executor, Recoverable recoverer, RequestVerifier verifier)
Constructor- Parameters:
id
- Replica IDexecutor
- Executorrecoverer
- Recovererverifier
- Requests verifier
-
ServiceReplica
public ServiceReplica(int id, Executable executor, Recoverable recoverer, RequestVerifier verifier, Replier replier)
Constructor- See Also:
bellow
-
ServiceReplica
public ServiceReplica(int id, Executable executor, Recoverable recoverer, RequestVerifier verifier, Replier replier, KeyLoader loader, java.security.Provider provider)
Constructor- See Also:
bellow
-
ServiceReplica
public ServiceReplica(int id, java.lang.String configHome, Executable executor, Recoverable recoverer, RequestVerifier verifier, Replier replier, KeyLoader loader)
Constructor- Parameters:
id
- Replica IDconfigHome
- Configuration directory for BFT-SMARTexecutor
- The executor implementationrecoverer
- The recoverer implementationverifier
- Requests Verifierreplier
- 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)
-
receiveReadonlyMessage
public final void receiveReadonlyMessage(TOMMessage message, MessageContext msgCtx)
-
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
-
-