private void validateClassicGroupHeartbeat(
        ClassicGroup group,
        String memberId,
        String groupInstanceId,
        int generationId
    ) throws CoordinatorNotAvailableException, IllegalGenerationException {
        if (group.isInState(DEAD)) {
            throw COORDINATOR_NOT_AVAILABLE.exception();
        } else {
            group.validateMember(
                memberId,
                groupInstanceId,
                "heartbeat"
            );

            if (generationId != group.generationId()) {
                throw ILLEGAL_GENERATION.exception();
            }
        }
    }
Validates a classic group heartbeat request.

@param group              The group.
@param memberId           The member id.
@param groupInstanceId    The group instance id.
@param generationId       The generation id.

@throws CoordinatorNotAvailableException If group is Dead.
@throws IllegalGenerationException       If the generation id in the request and the generation id of the
                                         group does not match.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java