public boolean canRebalance() {
        return PREPARING_REBALANCE.validPreviousStates().contains(state);
    }
@return whether the group can rebalance.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/classic/ClassicGroup.java