Search in sources :

Example 71 with MemberImpl

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

the class ClusterServiceImpl method createMember.

private MemberImpl createMember(MemberInfo memberInfo, String ipV6ScopeId) {
    Address address = memberInfo.getAddress();
    address.setScopeId(ipV6ScopeId);
    return new MemberImpl(address, memberInfo.getVersion(), thisAddress.equals(address), memberInfo.getUuid(), (HazelcastInstanceImpl) nodeEngine.getHazelcastInstance(), memberInfo.getAttributes(), memberInfo.isLiteMember());
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl)

Example 72 with MemberImpl

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

the class ClusterServiceImpl method registerThisMember.

private void registerThisMember() {
    MemberImpl thisMember = node.getLocalMember();
    setMembers(thisMember);
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl)

Example 73 with MemberImpl

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

the class MemberMap method createNew.

/**
     * Creates a new {@code MemberMap} including given members.
     *
     * @param members members
     * @return a new {@code MemberMap}
     */
static MemberMap createNew(MemberImpl... members) {
    Map<Address, MemberImpl> addressMap = new LinkedHashMap<Address, MemberImpl>();
    Map<String, MemberImpl> uuidMap = new LinkedHashMap<String, MemberImpl>();
    for (MemberImpl member : members) {
        putMember(addressMap, uuidMap, member);
    }
    return new MemberMap(addressMap, uuidMap);
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) LinkedHashMap(java.util.LinkedHashMap)

Example 74 with MemberImpl

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

the class MemberMap method cloneAdding.

/**
     * Creates clone of source {@code MemberMap} additionally including new members.
     *
     * @param source     source map
     * @param newMembers new members to add
     * @return clone map
     */
static MemberMap cloneAdding(MemberMap source, MemberImpl... newMembers) {
    Map<Address, MemberImpl> addressMap = new LinkedHashMap<Address, MemberImpl>(source.addressToMemberMap);
    Map<String, MemberImpl> uuidMap = new LinkedHashMap<String, MemberImpl>(source.uuidToMemberMap);
    for (MemberImpl member : newMembers) {
        putMember(addressMap, uuidMap, member);
    }
    return new MemberMap(addressMap, uuidMap);
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) LinkedHashMap(java.util.LinkedHashMap)

Example 75 with MemberImpl

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

the class MemberMap method putMember.

private static void putMember(Map<Address, MemberImpl> addressMap, Map<String, MemberImpl> uuidMap, MemberImpl member) {
    MemberImpl current = addressMap.put(member.getAddress(), member);
    if (current != null) {
        throw new IllegalArgumentException("Replacing existing member with address: " + member);
    }
    current = uuidMap.put(member.getUuid(), member);
    if (current != null) {
        throw new IllegalArgumentException("Replacing existing member with uuid: " + member);
    }
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl)

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