use of com.hazelcast.spi.discovery.DiscoveryNode in project hazelcast by hazelcast.
the class DiscoveryJoinerTest method init.
@Before
public void init() throws Exception {
discoveryNodes = new ArrayList<DiscoveryNode>(2);
Address publicAddress = new Address("127.0.0.1", 50001);
Address privateAddress = new Address("127.0.0.2", 50001);
discoveryNodes.add(new SimpleDiscoveryNode(privateAddress, publicAddress));
publicAddress = new Address("127.0.0.1", 50002);
privateAddress = new Address("127.0.0.2", 50002);
discoveryNodes.add(new SimpleDiscoveryNode(privateAddress, publicAddress));
factory = new TestHazelcastInstanceFactory(1);
hz = factory.newHazelcastInstance();
}
use of com.hazelcast.spi.discovery.DiscoveryNode in project hazelcast by hazelcast.
the class DiscoveryAddressTranslator method refresh.
@Override
public void refresh() {
Iterable<DiscoveryNode> discoveredNodes = checkNotNull(discoveryService.discoverNodes(), "Discovered nodes cannot be null!");
Map<Address, Address> privateToPublic = new HashMap<Address, Address>();
for (DiscoveryNode discoveryNode : discoveredNodes) {
privateToPublic.put(discoveryNode.getPrivateAddress(), discoveryNode.getPublicAddress());
}
this.privateToPublic = privateToPublic;
}
use of com.hazelcast.spi.discovery.DiscoveryNode in project hazelcast by hazelcast.
the class DiscoveryJoiner method getPossibleAddresses.
@Override
protected Collection<Address> getPossibleAddresses() {
Iterable<DiscoveryNode> discoveredNodes = checkNotNull(discoveryService.discoverNodes(), "Discovered nodes cannot be null!");
MemberImpl localMember = node.nodeEngine.getLocalMember();
Address localAddress = localMember.getAddress();
Collection<Address> possibleMembers = new ArrayList<Address>();
for (DiscoveryNode discoveryNode : discoveredNodes) {
Address discoveredAddress = usePublicAddress ? discoveryNode.getPublicAddress() : discoveryNode.getPrivateAddress();
if (localAddress.equals(discoveredAddress)) {
continue;
}
possibleMembers.add(discoveredAddress);
}
return possibleMembers;
}
Aggregations