@Nullable
    public static SafeCloseable invokeHook(RequestContext ctx) {
        final Supplier<AutoCloseable> hook = ctx.hook();

        if (hook == NOOP_CONTEXT_HOOK) {
            return null;
        }

        final AutoCloseable closeable;
        try {
            closeable = hook.get();
        } catch (Throwable t) {
            logger.warn("Unexpected exception while executing RequestContext.hook().get(). ctx: {}", ctx, t);
            return null;
        }

        if (closeable == null) {
            logger.warn("RequestContext.hook().get() returned null. ctx: {}", ctx);
            return null;
        }

        return () -> {
            try {
                closeable.close();
            } catch (Throwable t) {
                logger.warn("{} Unexpected exception while closing RequestContext.hook().", ctx, t);
            }
        };
    }
Invokes {@link DefaultServiceRequestContext#hook()} or {@link DefaultClientRequestContext#hook()} and
returns {@link SafeCloseable} which pops the current {@link RequestContext} in the storage and pushes
back the specified {@code toRestore}.
core/src/main/java/com/linecorp/armeria/internal/common/RequestContextUtil.java