use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method cloneExcluding.
@Test
public void cloneExcluding() {
MemberImpl[] members = new MemberImpl[6];
for (int i = 0; i < members.length; i++) {
members[i] = newMember(5000 + i);
}
MemberImpl exclude0 = members[0];
MemberImpl exclude1 = new MemberImpl(newAddress(6000), VERSION, false, members[1].getUuid(), null);
MemberImpl exclude2 = new MemberImpl(members[2].getAddress(), VERSION, false, newUnsecureUuidString(), null);
MemberMap map = MemberMap.cloneExcluding(MemberMap.createNew(members), exclude0, exclude1, exclude2);
int numOfExcludedMembers = 3;
assertEquals(members.length - numOfExcludedMembers, map.getMembers().size());
assertEquals(members.length - numOfExcludedMembers, map.getAddresses().size());
assertEquals(members.length - numOfExcludedMembers, map.size());
for (int i = 0; i < numOfExcludedMembers; i++) {
MemberImpl member = members[i];
assertNotContains(map, member.getAddress());
assertNotContains(map, member.getUuid());
assertNull(map.getMember(member.getAddress()));
assertNull(map.getMember(member.getUuid()));
}
for (int i = numOfExcludedMembers; i < members.length; i++) {
MemberImpl member = members[i];
assertContains(map, member.getAddress());
assertContains(map, member.getUuid());
assertSame(member, map.getMember(member.getAddress()));
assertSame(member, map.getMember(member.getUuid()));
}
assertMemberSet(map);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method cloneAdding.
@Test
public void cloneAdding() {
MemberImpl[] members = new MemberImpl[5];
for (int i = 0; i < members.length; i++) {
members[i] = newMember(5000 + i);
}
MemberMap map = MemberMap.cloneAdding(MemberMap.createNew(members[0], members[1], members[2]), members[3], members[4]);
assertEquals(members.length, map.getMembers().size());
assertEquals(members.length, map.getAddresses().size());
assertEquals(members.length, map.size());
for (MemberImpl member : members) {
assertContains(map, member.getAddress());
assertContains(map, member.getUuid());
assertSame(member, map.getMember(member.getAddress()));
assertSame(member, map.getMember(member.getUuid()));
}
assertMemberSet(map);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method createNew.
@Test
public void createNew() {
MemberImpl[] members = new MemberImpl[5];
for (int i = 0; i < members.length; i++) {
members[i] = newMember(5000 + i);
}
MemberMap map = MemberMap.createNew(members);
assertEquals(members.length, map.getMembers().size());
assertEquals(members.length, map.getAddresses().size());
assertEquals(members.length, map.size());
for (MemberImpl member : members) {
assertContains(map, member.getAddress());
assertContains(map, member.getUuid());
assertSame(member, map.getMember(member.getAddress()));
assertSame(member, map.getMember(member.getUuid()));
}
assertMemberSet(map);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method createSingleton.
@Test
public void createSingleton() {
MemberImpl member = newMember(5000);
MemberMap map = MemberMap.singleton(member);
assertEquals(1, map.getMembers().size());
assertEquals(1, map.getAddresses().size());
assertEquals(1, map.size());
assertContains(map, member.getAddress());
assertContains(map, member.getUuid());
assertSame(member, map.getMember(member.getAddress()));
assertSame(member, map.getMember(member.getUuid()));
assertMemberSet(map);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class MapDestroyCacheMessageTask method call.
@Override
protected Object call() throws Exception {
ClusterService clusterService = clientEngine.getClusterService();
Collection<MemberImpl> members = clusterService.getMemberImpls();
List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>(members.size());
createInvocations(members, futures);
Collection<Boolean> results = FutureUtil.returnWithDeadline(futures, 1, TimeUnit.MINUTES);
return reduce(results);
}
Aggregations