use of com.alibaba.nacos.core.distributed.raft.exception.JRaftException in project nacos by alibaba.
the class JRaftServer method start.
synchronized void start() {
if (!isStarted) {
Loggers.RAFT.info("========= The raft protocol is starting... =========");
try {
// init raft group node
com.alipay.sofa.jraft.NodeManager raftNodeManager = com.alipay.sofa.jraft.NodeManager.getInstance();
for (String address : raftConfig.getMembers()) {
PeerId peerId = PeerId.parsePeer(address);
conf.addPeer(peerId);
raftNodeManager.addAddress(peerId.getEndpoint());
}
nodeOptions.setInitialConf(conf);
rpcServer = JRaftUtils.initRpcServer(this, localPeerId);
if (!this.rpcServer.init(null)) {
Loggers.RAFT.error("Fail to init [BaseRpcServer].");
throw new RuntimeException("Fail to init [BaseRpcServer].");
}
// Initialize multi raft group service framework
isStarted = true;
createMultiRaftGroup(processors);
Loggers.RAFT.info("========= The raft protocol start finished... =========");
} catch (Exception e) {
Loggers.RAFT.error("raft protocol start failure, cause: ", e);
throw new JRaftException(e);
}
}
}
Aggregations