Search in sources :

Example 51 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class ClusterHeartbeatManager method sendMemberListToOthers.

/** Invoked on the master to send the member list (see {@link MemberInfoUpdateOperation}) to non-master nodes. */
private void sendMemberListToOthers() {
    if (!node.isMaster()) {
        return;
    }
    Collection<MemberImpl> members = clusterService.getMemberImpls();
    List<MemberInfo> memberInfos = createMemberInfoList(members);
    for (MemberImpl member : members) {
        if (member.localMember()) {
            continue;
        }
        MemberInfoUpdateOperation op = new MemberInfoUpdateOperation(member.getUuid(), memberInfos, clusterClock.getClusterTime(), null, false);
        nodeEngine.getOperationService().send(op, member.getAddress());
    }
}
Also used : MemberInfo(com.hazelcast.internal.cluster.MemberInfo) MemberImpl(com.hazelcast.instance.MemberImpl) MemberInfoUpdateOperation(com.hazelcast.internal.cluster.impl.operations.MemberInfoUpdateOperation)

Example 52 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberSelectingIteratorTest method before.

@Before
public void before() throws Exception {
    MemberVersion version = new MemberVersion(BuildInfoProvider.BUILD_INFO.getVersion());
    thisMember = new MemberImpl(new Address("localhost", 5701), version, true, true);
    matchingMember = new MemberImpl(new Address("localhost", 5702), version, false, true);
    matchingMember2 = new MemberImpl(new Address("localhost", 5703), version, false, true);
    nonMatchingMember = new MemberImpl(new Address("localhost", 5704), version, false, false);
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) MemberVersion(com.hazelcast.version.MemberVersion) Before(org.junit.Before)

Example 53 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberMapTest method assertMemberSet.

private static void assertMemberSet(MemberMap map) {
    for (MemberImpl member : map.getMembers()) {
        assertContains(map, member.getAddress());
        assertContains(map, member.getUuid());
        assertEquals(member, map.getMember(member.getAddress()));
        assertEquals(member, map.getMember(member.getUuid()));
    }
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl)

Example 54 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberMapTest method create_failsWithDuplicateUuid.

@Test(expected = IllegalArgumentException.class)
public void create_failsWithDuplicateUuid() {
    MemberImpl member1 = newMember(5000);
    MemberImpl member2 = new MemberImpl(newAddress(5001), VERSION, false, member1.getUuid(), null);
    MemberMap.createNew(member1, member2);
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 55 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberMapTest method getMembers_ordered.

@Test
public void getMembers_ordered() {
    MemberImpl[] members = new MemberImpl[10];
    for (int i = 0; i < members.length; i++) {
        members[i] = newMember(5000 + i);
    }
    MemberMap map = MemberMap.createNew(members);
    Set<MemberImpl> memberSet = map.getMembers();
    int index = 0;
    for (MemberImpl member : memberSet) {
        assertSame(members[index++], member);
    }
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

MemberImpl (com.hazelcast.instance.MemberImpl)86 Address (com.hazelcast.nio.Address)37 Test (org.junit.Test)18 Member (com.hazelcast.core.Member)17 QuickTest (com.hazelcast.test.annotation.QuickTest)16 ParallelTest (com.hazelcast.test.annotation.ParallelTest)14 ArrayList (java.util.ArrayList)12 InetAddress (java.net.InetAddress)9 Future (java.util.concurrent.Future)9 HashSet (java.util.HashSet)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)7 MemberInfo (com.hazelcast.internal.cluster.MemberInfo)7 ClusterService (com.hazelcast.internal.cluster.ClusterService)5 MemberInfoUpdateOperation (com.hazelcast.internal.cluster.impl.operations.MemberInfoUpdateOperation)5 PartitionRuntimeState (com.hazelcast.internal.partition.PartitionRuntimeState)5 ILogger (com.hazelcast.logging.ILogger)5 OperationService (com.hazelcast.spi.OperationService)5 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)5 Before (org.junit.Before)5 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)4