Search in sources :

Example 6 with MemberImpl

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

the class LockServiceImpl method memberRemoved.

@Override
public void memberRemoved(MembershipServiceEvent event) {
    final MemberImpl member = event.getMember();
    final String uuid = member.getUuid();
    releaseLocksOwnedBy(uuid);
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl)

Example 7 with MemberImpl

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

the class MemberAttributeEvent method readData.

@Override
public void readData(ObjectDataInput in) throws IOException {
    key = in.readUTF();
    member = new MemberImpl();
    member.readData(in);
    operationType = MemberAttributeOperationType.getValue(in.readByte());
    if (operationType == PUT) {
        value = IOUtil.readAttributeValue(in);
    }
    this.source = member;
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl)

Example 8 with MemberImpl

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

the class ClusterDataSerializerHook method createFactory.

@Override
public DataSerializableFactory createFactory() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
    constructors[AUTH_FAILURE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new AuthenticationFailureOperation();
        }
    };
    constructors[ADDRESS] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new Address();
        }
    };
    constructors[MEMBER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemberImpl();
        }
    };
    constructors[HEARTBEAT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new HeartbeatOperation();
        }
    };
    constructors[CONFIG_CHECK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ConfigCheck();
        }
    };
    constructors[BIND_MESSAGE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new BindMessage();
        }
    };
    constructors[MEMBER_INFO_UPDATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemberInfoUpdateOperation();
        }
    };
    constructors[FINALIZE_JOIN] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new FinalizeJoinOperation();
        }
    };
    constructors[AUTHORIZATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new AuthorizationOperation();
        }
    };
    constructors[BEFORE_JOIN_CHECK_FAILURE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new BeforeJoinCheckFailureOperation();
        }
    };
    constructors[CHANGE_CLUSTER_STATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ChangeClusterStateOperation();
        }
    };
    constructors[CONFIG_MISMATCH] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ConfigMismatchOperation();
        }
    };
    constructors[GROUP_MISMATCH] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new GroupMismatchOperation();
        }
    };
    constructors[SPLIT_BRAIN_MERGE_VALIDATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SplitBrainMergeValidationOperation();
        }
    };
    constructors[JOIN_REQUEST_OP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new JoinRequestOperation();
        }
    };
    constructors[LOCK_CLUSTER_STATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new LockClusterStateOperation();
        }
    };
    constructors[MASTER_CLAIM] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MasterClaimOperation();
        }
    };
    constructors[MASTER_CONFIRM] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MasterConfirmationOperation();
        }
    };
    constructors[MASTER_DISCOVERY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MasterDiscoveryOperation();
        }
    };
    constructors[MEMBER_ATTR_CHANGED] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemberAttributeChangedOperation();
        }
    };
    constructors[MEMBER_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemberRemoveOperation();
        }
    };
    constructors[MERGE_CLUSTERS] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MergeClustersOperation();
        }
    };
    constructors[POST_JOIN] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PostJoinOperation();
        }
    };
    constructors[ROLLBACK_CLUSTER_STATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RollbackClusterStateOperation();
        }
    };
    constructors[SET_MASTER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SetMasterOperation();
        }
    };
    constructors[SHUTDOWN_NODE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ShutdownNodeOperation();
        }
    };
    constructors[TRIGGER_MEMBER_LIST_PUBLISH] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TriggerMemberListPublishOperation();
        }
    };
    constructors[CLUSTER_STATE_TRANSACTION_LOG_RECORD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ClusterStateTransactionLogRecord();
        }
    };
    constructors[MEMBER_INFO] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemberInfo();
        }
    };
    constructors[JOIN_MESSAGE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new JoinMessage();
        }
    };
    constructors[JOIN_REQUEST] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new JoinRequest();
        }
    };
    constructors[MIGRATION_INFO] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MigrationInfo();
        }
    };
    constructors[MEMBER_VERSION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new MemberVersion();
        }
    };
    constructors[CLUSTER_STATE_CHANGE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ClusterStateChange();
        }
    };
    constructors[SPLIT_BRAIN_JOIN_MESSAGE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SplitBrainJoinMessage();
        }
    };
    constructors[VERSION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new Version();
        }
    };
    return new ArrayDataSerializableFactory(constructors);
}
Also used : MemberAttributeChangedOperation(com.hazelcast.internal.cluster.impl.operations.MemberAttributeChangedOperation) MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address) MergeClustersOperation(com.hazelcast.internal.cluster.impl.operations.MergeClustersOperation) PostJoinOperation(com.hazelcast.internal.cluster.impl.operations.PostJoinOperation) SetMasterOperation(com.hazelcast.internal.cluster.impl.operations.SetMasterOperation) MemberVersion(com.hazelcast.version.MemberVersion) TriggerMemberListPublishOperation(com.hazelcast.internal.cluster.impl.operations.TriggerMemberListPublishOperation) MasterDiscoveryOperation(com.hazelcast.internal.cluster.impl.operations.MasterDiscoveryOperation) ConfigMismatchOperation(com.hazelcast.internal.cluster.impl.operations.ConfigMismatchOperation) MemberInfo(com.hazelcast.internal.cluster.MemberInfo) SplitBrainMergeValidationOperation(com.hazelcast.internal.cluster.impl.operations.SplitBrainMergeValidationOperation) Version(com.hazelcast.version.Version) MemberVersion(com.hazelcast.version.MemberVersion) BeforeJoinCheckFailureOperation(com.hazelcast.internal.cluster.impl.operations.BeforeJoinCheckFailureOperation) ChangeClusterStateOperation(com.hazelcast.internal.cluster.impl.operations.ChangeClusterStateOperation) IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) LockClusterStateOperation(com.hazelcast.internal.cluster.impl.operations.LockClusterStateOperation) MemberImpl(com.hazelcast.instance.MemberImpl) MemberRemoveOperation(com.hazelcast.internal.cluster.impl.operations.MemberRemoveOperation) HeartbeatOperation(com.hazelcast.internal.cluster.impl.operations.HeartbeatOperation) MasterClaimOperation(com.hazelcast.internal.cluster.impl.operations.MasterClaimOperation) ShutdownNodeOperation(com.hazelcast.internal.cluster.impl.operations.ShutdownNodeOperation) ConstructorFunction(com.hazelcast.util.ConstructorFunction) MemberInfoUpdateOperation(com.hazelcast.internal.cluster.impl.operations.MemberInfoUpdateOperation) GroupMismatchOperation(com.hazelcast.internal.cluster.impl.operations.GroupMismatchOperation) FinalizeJoinOperation(com.hazelcast.internal.cluster.impl.operations.FinalizeJoinOperation) AuthorizationOperation(com.hazelcast.internal.cluster.impl.operations.AuthorizationOperation) MasterConfirmationOperation(com.hazelcast.internal.cluster.impl.operations.MasterConfirmationOperation) AuthenticationFailureOperation(com.hazelcast.internal.cluster.impl.operations.AuthenticationFailureOperation) JoinRequestOperation(com.hazelcast.internal.cluster.impl.operations.JoinRequestOperation) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory) RollbackClusterStateOperation(com.hazelcast.internal.cluster.impl.operations.RollbackClusterStateOperation)

Example 9 with MemberImpl

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

the class ClusterHeartbeatManager method heartbeatWhenMaster.

/**
     * Sends heartbeat to each of the cluster members.
     * Checks whether a member has failed to send a heartbeat or master-confirmation in time
     * (see {@link #maxNoHeartbeatMillis} and {@link #maxNoMasterConfirmationMillis})
     * and removes that member from the cluster.
     * <p></p>
     * This method is only called on the master member.
     *
     * @param now the current cluster clock time
     */
private void heartbeatWhenMaster(long now) {
    Collection<MemberImpl> members = clusterService.getMemberImpls();
    for (MemberImpl member : members) {
        if (!member.localMember()) {
            try {
                logIfConnectionToEndpointIsMissing(now, member);
                if (removeMemberIfNotHeartBeating(now, member)) {
                    continue;
                }
                if (removeMemberIfMasterConfirmationExpired(now, member)) {
                    continue;
                }
                pingMemberIfRequired(now, member);
                sendHeartbeat(member.getAddress());
            } catch (Throwable e) {
                logger.severe(e);
            }
        }
    }
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl)

Example 10 with MemberImpl

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

the class ClusterHeartbeatManager method sendMasterConfirmation.

/**
     * Sends a {@link MasterConfirmationOperation} to the master if this node is joined, it is not in the
     * {@link NodeState#SHUT_DOWN} state and is not the master node.
     */
public void sendMasterConfirmation() {
    if (!node.joined() || node.getState() == NodeState.SHUT_DOWN || node.isMaster()) {
        return;
    }
    Address masterAddress = node.getMasterAddress();
    if (masterAddress == null) {
        logger.fine("Could not send MasterConfirmation, masterAddress is null!");
        return;
    }
    MemberImpl masterMember = clusterService.getMember(masterAddress);
    if (masterMember == null) {
        logger.fine("Could not send MasterConfirmation, masterMember is null!");
        return;
    }
    if (logger.isFineEnabled()) {
        logger.fine("Sending MasterConfirmation to " + masterMember);
    }
    nodeEngine.getOperationService().send(new MasterConfirmationOperation(clusterClock.getClusterTime()), masterAddress);
}
Also used : MasterConfirmationOperation(com.hazelcast.internal.cluster.impl.operations.MasterConfirmationOperation) Address(com.hazelcast.nio.Address) 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