private static boolean isCompletingRebalance(MemberState currentState, MemberState nextState) {
        return currentState == MemberState.RECONCILING &&
                (nextState == MemberState.STABLE || nextState == MemberState.ACKNOWLEDGING);
    }
Update the member state, setting it to the nextState only if it is a valid transition.

@throws IllegalStateException If transitioning from the member {@link #state} to the
                              nextState is not allowed as defined in {@link MemberState}.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareMembershipManager.java