Search in sources :

Example 1 with InternalHotRestartService

use of com.hazelcast.hotrestart.InternalHotRestartService in project hazelcast by hazelcast.

the class TriggerPartialStartRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    Node node = mcs.getHazelcastInstance().node;
    final InternalHotRestartService hotRestartService = node.getNodeExtension().getInternalHotRestartService();
    final boolean done = hotRestartService.triggerPartialStart();
    String result = done ? SUCCESS_RESULT : FAILED_RESULT;
    out.add("result", result);
}
Also used : Node(com.hazelcast.instance.Node) InternalHotRestartService(com.hazelcast.hotrestart.InternalHotRestartService)

Example 2 with InternalHotRestartService

use of com.hazelcast.hotrestart.InternalHotRestartService in project hazelcast by hazelcast.

the class ClusterServiceImpl method removeMember.

private void removeMember(MemberImpl deadMember) {
    logger.info("Removing " + deadMember);
    lock.lock();
    try {
        MemberMap currentMembers = memberMapRef.get();
        final Address deadAddress = deadMember.getAddress();
        if (currentMembers.contains(deadAddress)) {
            clusterHeartbeatManager.removeMember(deadMember);
            MemberMap newMembers = MemberMap.cloneExcluding(currentMembers, deadMember);
            memberMapRef.set(newMembers);
            if (node.isMaster()) {
                if (logger.isFineEnabled()) {
                    logger.fine(deadMember + " is dead, sending remove to all other members...");
                }
                sendMemberRemoveOperation(deadMember);
            }
            final ClusterState clusterState = clusterStateManager.getState();
            if (clusterState != ClusterState.ACTIVE) {
                if (logger.isFineEnabled()) {
                    logger.fine(deadMember + " is dead, added to members left while cluster is " + clusterState + " state");
                }
                final InternalHotRestartService hotRestartService = node.getNodeExtension().getInternalHotRestartService();
                if (!hotRestartService.isMemberExcluded(deadAddress, deadMember.getUuid())) {
                    MemberMap membersRemovedInNotActiveState = membersRemovedInNotActiveStateRef.get();
                    membersRemovedInNotActiveStateRef.set(MemberMap.cloneAdding(membersRemovedInNotActiveState, deadMember));
                }
                InternalPartitionServiceImpl partitionService = node.partitionService;
                partitionService.cancelReplicaSyncRequestsTo(deadAddress);
            } else {
                onMemberRemove(deadMember, newMembers);
            }
            // async events
            sendMembershipEventNotifications(deadMember, unmodifiableSet(new LinkedHashSet<Member>(newMembers.getMembers())), false);
        }
    } finally {
        lock.unlock();
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ClusterState(com.hazelcast.cluster.ClusterState) Address(com.hazelcast.nio.Address) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) InternalHotRestartService(com.hazelcast.hotrestart.InternalHotRestartService)

Example 3 with InternalHotRestartService

use of com.hazelcast.hotrestart.InternalHotRestartService in project hazelcast by hazelcast.

the class ClusterJoinManager method checkJoinRequest.

@SuppressWarnings("checkstyle:npathcomplexity")
private boolean checkJoinRequest(JoinRequest joinRequest, Connection connection) {
    if (checkIfJoinRequestFromAnExistingMember(joinRequest, connection)) {
        return true;
    }
    final InternalHotRestartService hotRestartService = node.getNodeExtension().getInternalHotRestartService();
    Address target = joinRequest.getAddress();
    String targetUuid = joinRequest.getUuid();
    if (hotRestartService.isMemberExcluded(target, targetUuid)) {
        logger.fine("cannot join " + target + " because it is excluded in cluster start.");
        hotRestartService.notifyExcludedMember(target);
        return true;
    }
    if (checkClusterStateBeforeJoin(target, targetUuid)) {
        return true;
    }
    if (joinRequest.getExcludedMemberUuids().contains(node.getThisUuid())) {
        logger.warning("cannot join " + target + " since this node is excluded in its list...");
        hotRestartService.handleExcludedMemberUuids(target, joinRequest.getExcludedMemberUuids());
        return true;
    }
    if (!node.getPartitionService().isMemberAllowedToJoin(target)) {
        logger.warning(target + " not allowed to join right now, it seems restarted.");
        return true;
    }
    return false;
}
Also used : Address(com.hazelcast.nio.Address) InternalHotRestartService(com.hazelcast.hotrestart.InternalHotRestartService)

Aggregations

InternalHotRestartService (com.hazelcast.hotrestart.InternalHotRestartService)3 Address (com.hazelcast.nio.Address)2 ClusterState (com.hazelcast.cluster.ClusterState)1 Node (com.hazelcast.instance.Node)1 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)1 LinkedHashSet (java.util.LinkedHashSet)1