use of com.hazelcast.cluster.impl.MemberImpl 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();
Set<Address> localAddresses = node.getLocalAddressRegistry().getLocalAddresses();
Collection<Address> possibleMembers = new ArrayList<>();
for (DiscoveryNode discoveryNode : discoveredNodes) {
Address discoveredAddress = usePublicAddress ? discoveryNode.getPublicAddress() : discoveryNode.getPrivateAddress();
if (localAddresses.contains(discoveredAddress)) {
if (!usePublicAddress && discoveryNode.getPublicAddress() != null) {
// enrich member with client public address
localMember.getAddressMap().put(EndpointQualifier.resolve(ProtocolType.CLIENT, "public"), publicAddress(localMember, discoveryNode));
}
continue;
}
possibleMembers.add(discoveredAddress);
}
return possibleMembers;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class HostAwareMemberGroupFactory method createInternalMemberGroups.
@Override
protected Set<MemberGroup> createInternalMemberGroups(Collection<? extends Member> allMembers) {
Map<String, MemberGroup> groups = createHashMap(allMembers.size());
for (Member member : allMembers) {
Address address = ((MemberImpl) member).getAddress();
MemberGroup group = groups.get(address.getHost());
if (group == null) {
group = new DefaultMemberGroup();
groups.put(address.getHost(), group);
}
group.addMember(member);
}
return new HashSet<MemberGroup>(groups.values());
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method createMembersWithPlacementAwareMetadata.
private Collection<Member> createMembersWithPlacementAwareMetadata() {
Collection<Member> members = new HashSet<>();
MemberImpl member1 = new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, true);
member1.setAttribute(PartitionGroupMetaData.PARTITION_GROUP_PLACEMENT, "us-east-1a-placement-1");
MemberImpl member2 = new MemberImpl(new Address("192.192.0.2", fakeAddress, 5701), VERSION, true);
member2.setAttribute(PartitionGroupMetaData.PARTITION_GROUP_PLACEMENT, "us-east-1a-placement-2");
MemberImpl member3 = new MemberImpl(new Address("192.192.0.3", fakeAddress, 5701), VERSION, true);
member3.setAttribute(PartitionGroupMetaData.PARTITION_GROUP_PLACEMENT, "us-east-1a-placement-3");
members.add(member1);
members.add(member2);
members.add(member3);
return members;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method createMembersWithZoneAwareMetadata.
private Collection<Member> createMembersWithZoneAwareMetadata() {
Collection<Member> members = new HashSet<Member>();
MemberImpl member1 = new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, true);
member1.setAttribute(PartitionGroupMetaData.PARTITION_GROUP_ZONE, "us-east-1");
MemberImpl member2 = new MemberImpl(new Address("192.192.0.2", fakeAddress, 5701), VERSION, true);
member2.setAttribute(PartitionGroupMetaData.PARTITION_GROUP_ZONE, "us-west-1");
MemberImpl member3 = new MemberImpl(new Address("192.192.0.3", fakeAddress, 5701), VERSION, true);
member3.setAttribute(PartitionGroupMetaData.PARTITION_GROUP_ZONE, "eu-central-1");
members.add(member1);
members.add(member2);
members.add(member3);
return members;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method createMembers.
private Collection<Member> createMembers() {
Collection<Member> members = new HashSet<Member>();
members.add(new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("192.192.0.1", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("192.168.3.101", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("192.168.3.101", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("172.16.5.11", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("172.16.5.11", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("172.123.0.13", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("172.123.0.13", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.com.tr", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.com.tr", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("jobs.hazelcast.com", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("jobs.hazelcast.com", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.org", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.org", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("download.hazelcast.org", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("download.hazelcast.org", fakeAddress, 5702), VERSION, false));
return members;
}
Aggregations