public <T> T completeRequest(FutureCallback<T> cb) throws Throwable {
        try {
            return cb.get(requestTimeout.timeoutMs(), TimeUnit.MILLISECONDS);
        } catch (ExecutionException e) {
            throw e.getCause();
        } catch (StagedTimeoutException e) {
            Stage stage = e.stage();
            String message = "Request timed out. " + stage.summarize();
            // This timeout is for the operation itself. None of the timeout error codes are relevant, so internal server
            // error is the best option
            throw new ConnectRestException(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), message);
        } catch (TimeoutException e) {
            // This timeout is for the operation itself. None of the timeout error codes are relevant, so internal server
            // error is the best option
            throw new ConnectRestException(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), "Request timed out");
        } catch (InterruptedException e) {
            throw new ConnectRestException(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), "Request interrupted");
        }
    }
Wait for a {@link FutureCallback} to complete and return the result if successful.
@param cb the future callback to wait for
@return the future callback's result if successful
@param <T> the future's result type
@throws Throwable if the future callback isn't successful
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/HerderRequestHandler.java