Search in sources :

Example 1 with TerminateRaftNodesOp

use of com.hazelcast.cp.internal.raftop.metadata.TerminateRaftNodesOp in project hazelcast by hazelcast.

the class MetadataRaftGroupManager method sendTerminateRaftNodeOpsForDestroyedGroup.

private void sendTerminateRaftNodeOpsForDestroyedGroup(CPGroupInfo group) {
    Map<UUID, CPMemberInfo> activeMembersMap = getActiveMembersMap();
    CPMemberInfo localCPMember = getLocalCPMember();
    if (localCPMember == null) {
        return;
    }
    RaftEndpoint localEndpoint = localCPMember.toRaftEndpoint();
    OperationService operationService = nodeEngine.getOperationService();
    for (RaftEndpoint endpoint : group.members()) {
        if (endpoint.equals(localEndpoint)) {
            terminateRaftNodeAsync(group.id());
        } else {
            Operation op = new TerminateRaftNodesOp(Collections.singleton(group.id()));
            CPMemberInfo cpMember = activeMembersMap.get(endpoint.getUuid());
            operationService.invokeOnTarget(SERVICE_NAME, op, cpMember.getAddress());
        }
    }
}
Also used : RaftEndpoint(com.hazelcast.cp.internal.raft.impl.RaftEndpoint) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) Operation(com.hazelcast.spi.impl.operationservice.Operation) UUID(java.util.UUID) TerminateRaftNodesOp(com.hazelcast.cp.internal.raftop.metadata.TerminateRaftNodesOp)

Aggregations

RaftEndpoint (com.hazelcast.cp.internal.raft.impl.RaftEndpoint)1 TerminateRaftNodesOp (com.hazelcast.cp.internal.raftop.metadata.TerminateRaftNodesOp)1 Operation (com.hazelcast.spi.impl.operationservice.Operation)1 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)1 UUID (java.util.UUID)1