void doTransitionTo(TargetState targetState, Callback<TargetState> stateChangeCallback) {
        // Edge case: we don't do transitions most of the time if we've already failed, but for the STOPPED state, it's fine
        if (state == State.FAILED && targetState != TargetState.STOPPED) {
            stateChangeCallback.onCompletion(
                    new ConnectException(this + " Cannot transition connector to " + targetState + " since it has failed"),
                    null);
            return;
        }

        try {
            doTransitionTo(targetState);
            stateChangeCallback.onCompletion(null, targetState);
        } catch (Throwable t) {
            stateChangeCallback.onCompletion(
                    new ConnectException(
                            "Failed to transition connector " + connName + " to state " + targetState,
                            t),
                    null);
        }
    }
Wait for this connector to finish shutting down.

@param timeoutMs time in milliseconds to await shutdown
@return true if successful, false if the timeout was reached
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConnector.java