@Override
    public CompletionStage<Void> executeBlockingIo(RunnableWithException f,
                                                   boolean hasInterceptors) {
        if (!isIoThread()) {
            // we're blocking
            try {
                f.run();
            } catch (Exception e) {
                final CompletableFuture<Void> ret = new CompletableFuture<>();
                ret.completeExceptionally(e);
                return ret;
            }
            return UnmodifiableFuture.completedFuture(null);
        } else if (!hasInterceptors) {
            final Map<Class<?>, Object> context = ResteasyContext.getContextDataMap();
            // turn any sync request into async
            if (!isSuspended()) {
                suspend();
            }
            return CompletableFuture.runAsync(() -> {
                try (CloseableContext newContext = ResteasyContext.addCloseableContextDataLevel(context)) {
                    f.run();
                } catch (RuntimeException e) {
                    throw e;
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            });
        } else {
            final CompletableFuture<Void> ret = new CompletableFuture<>();
            ret.completeExceptionally(new RuntimeException(
                    "Cannot use blocking IO with interceptors when we're on the IO thread"));
            return ret;
        }
    }
Suspends client connection for asynchronous request processing.
@param time an amount of time to suspend client connection for, expressed in provided units.
@param unit an {@link TimeUnit} for {@code time} parameter.
@throws IllegalStateException if it was previously suspended.
resteasy/src/main/java/com/linecorp/armeria/server/resteasy/ResteasyAsynchronousExecutionContextImpl.java