use of io.atomix.cluster.impl.DefaultClusterMetadataService in project atomix by atomix.
the class RaftPerformanceTest method createServer.
/**
* Creates a Raft server.
*/
private RaftServer createServer(Node node, List<Node> members) throws UnknownHostException {
RaftServerProtocol protocol;
ManagedMessagingService messagingService;
if (USE_NETTY) {
messagingService = (ManagedMessagingService) NettyMessagingService.builder().withEndpoint(node.endpoint()).build().start().join();
messagingServices.add(messagingService);
protocol = new RaftServerMessagingProtocol(messagingService, protocolSerializer, endpointMap::get);
} else {
protocol = protocolFactory.newServerProtocol(node.id());
}
RaftServer.Builder builder = RaftServer.builder(node.id()).withProtocol(protocol).withThreadModel(ThreadModel.THREAD_PER_SERVICE).withClusterService(new DefaultClusterService(node, new DefaultClusterMetadataService(ClusterMetadata.builder().withBootstrapNodes(members).build(), messagingService), messagingService)).withStorage(RaftStorage.builder().withStorageLevel(StorageLevel.MAPPED).withDirectory(new File(String.format("target/perf-logs/%s", node.id()))).withSerializer(storageSerializer).withMaxEntriesPerSegment(32768).withMaxSegmentSize(1024 * 1024).build()).addPrimitiveType(TestPrimitiveType.INSTANCE);
RaftServer server = builder.build();
servers.add(server);
return server;
}
Aggregations