use of bftsmart.communication.ServerCommunicationSystem in project aware by bergerch.
the class ServiceReplica method init.
// this method initializes the object
private void init() {
try {
cs = new ServerCommunicationSystem(this.SVController, this);
} catch (Exception ex) {
logger.error("Failed to initialize replica-to-replica communication system", ex);
throw new RuntimeException("Unable to build a communication system.");
}
if (this.SVController.isInCurrentView()) {
logger.info("In current view: " + this.SVController.getCurrentView());
// initiaze the TOM layer
initTOMLayer();
} else {
logger.info("Not in current view: " + this.SVController.getCurrentView());
// Not in the initial view, just waiting for the view where the join has been executed
logger.info("Waiting for the TTP: " + this.SVController.getCurrentView());
waitTTPJoinMsgLock.lock();
try {
canProceed.awaitUninterruptibly();
} finally {
waitTTPJoinMsgLock.unlock();
}
}
initReplica();
}
use of bftsmart.communication.ServerCommunicationSystem in project bftsmart by blockchain-jd-com.
the class TestNodeServer method startNode.
public ServiceReplica startNode(String realmName) {
TOMConfiguration config = initConfig();
try {
// mock messsageHandler and cs
MessageHandler messageHandler = new MessageHandler();
MessageHandler mockMessageHandler = Mockito.spy(messageHandler);
ClientCommunicationServerSide clientCommunication = ClientCommunicationFactory.createServerSide(new ServerViewController(config, new MemoryBasedViewStorage(latestView)));
ServerCommunicationSystem cs = new ServerCommunicationSystemImpl(clientCommunication, mockMessageHandler, new ServerViewController(config, new MemoryBasedViewStorage(latestView)), realmName);
ServerCommunicationSystem mockCs = Mockito.spy(cs);
replica = new ServiceReplica(mockMessageHandler, mockCs, config, this, this, (int) -1, latestView, realmName);
} catch (Exception e) {
e.printStackTrace();
}
return replica;
}
Aggregations