Search in sources :

Example 56 with MemberImpl

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

the class MemberMapTest method create_failsWithDuplicateAddress.

@Test(expected = IllegalArgumentException.class)
public void create_failsWithDuplicateAddress() {
    MemberImpl member1 = newMember(5000);
    MemberImpl member2 = newMember(5000);
    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 57 with MemberImpl

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

the class MemberMapTest method cloneAdding_failsWithDuplicateUuid.

@Test(expected = IllegalArgumentException.class)
public void cloneAdding_failsWithDuplicateUuid() {
    MemberImpl[] members = new MemberImpl[3];
    for (int i = 0; i < members.length; i++) {
        members[i] = newMember(5000 + i);
    }
    MemberImpl member = new MemberImpl(newAddress(6000), VERSION, false, members[1].getUuid(), null);
    MemberMap.cloneAdding(MemberMap.createNew(members), member);
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 58 with MemberImpl

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

the class MemberLeftException method readObject.

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    String uuid = in.readUTF();
    String host = in.readUTF();
    int port = in.readInt();
    boolean liteMember = in.readBoolean();
    MemberVersion version = (MemberVersion) in.readObject();
    member = new MemberImpl(new Address(host, port), version, false, uuid, null, null, liteMember);
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) MemberVersion(com.hazelcast.version.MemberVersion)

Example 59 with MemberImpl

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

the class PartitionStateManager method removeUnknownAddresses.

void removeUnknownAddresses() {
    ClusterServiceImpl clusterService = node.getClusterService();
    for (InternalPartitionImpl partition : partitions) {
        for (int i = 0; i < InternalPartition.MAX_REPLICA_COUNT; i++) {
            Address address = partition.getReplicaAddress(i);
            if (address == null) {
                continue;
            }
            MemberImpl member = clusterService.getMember(address);
            if (member == null) {
                partition.setReplicaAddress(i, null);
                if (logger.isFinestEnabled()) {
                    logger.finest("PartitionId=" + partition.getPartitionId() + " " + address + " is removed from replica index: " + i + ", partition: " + partition);
                }
            }
        }
    }
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl)

Example 60 with MemberImpl

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

the class PartitionEventManager method sendMigrationEvent.

void sendMigrationEvent(final MigrationInfo migrationInfo, final MigrationEvent.MigrationStatus status) {
    if (migrationInfo.getSourceCurrentReplicaIndex() != 0 && migrationInfo.getDestinationNewReplicaIndex() != 0) {
        // only fire events for 0th replica migrations
        return;
    }
    ClusterServiceImpl clusterService = node.getClusterService();
    MemberImpl current = clusterService.getMember(migrationInfo.getSource());
    MemberImpl newOwner = clusterService.getMember(migrationInfo.getDestination());
    MigrationEvent event = new MigrationEvent(migrationInfo.getPartitionId(), current, newOwner, status);
    EventService eventService = nodeEngine.getEventService();
    Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, MIGRATION_EVENT_TOPIC);
    eventService.publishEvent(SERVICE_NAME, registrations, event, event.getPartitionId());
}
Also used : EventRegistration(com.hazelcast.spi.EventRegistration) MemberImpl(com.hazelcast.instance.MemberImpl) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) EventService(com.hazelcast.spi.EventService) MigrationEvent(com.hazelcast.core.MigrationEvent)

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