public static Supplier<AutoCloseable> mergeHooks(Supplier<? extends AutoCloseable> hook1,
                                                     Supplier<? extends AutoCloseable> hook2) {
        if (hook1 == NOOP_CONTEXT_HOOK) {
            //noinspection unchecked
            return (Supplier<AutoCloseable>) hook2;
        } else if (hook2 == NOOP_CONTEXT_HOOK) {
            //noinspection unchecked
            return (Supplier<AutoCloseable>) hook1;
        } else {
            return () -> {
                final AutoCloseable closeable1 = hook1.get();
                final AutoCloseable closeable2 = hook2.get();
                return () -> {
                    try {
                        closeable2.close();
                    } finally {
                        closeable1.close();
                    }
                };
            };
        }
    }
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