use of io.atomix.cluster.discovery.NodeDiscoveryProvider in project atomix by atomix.
the class SwimProtocolTest method startProtocol.
private SwimMembershipProtocol startProtocol(Member member) {
SwimMembershipProtocol protocol = new SwimMembershipProtocol(new SwimMembershipProtocolConfig().setFailureTimeout(Duration.ofSeconds(2)));
TestGroupMembershipEventListener listener = new TestGroupMembershipEventListener();
listeners.put(member.id(), listener);
protocol.addListener(listener);
BootstrapService bootstrap = new TestBootstrapService(messagingServiceFactory.newMessagingService(member.address()).start().join(), unicastServiceFactory.newUnicastService(member.address()).start().join(), broadcastServiceFactory.newBroadcastService().start().join());
NodeDiscoveryProvider provider = new BootstrapDiscoveryProvider(nodes);
provider.join(bootstrap, member).join();
NodeDiscoveryService discovery = new DefaultNodeDiscoveryService(bootstrap, member, provider).start().join();
protocol.join(bootstrap, discovery, member).join();
protocols.put(member.id(), protocol);
return protocol;
}
Aggregations