public static SafeCloseable invokeHookAndPop(RequestContext current, @Nullable RequestContext toRestore) {
        requireNonNull(current, "current");

        final SafeCloseable closeable = invokeHook(current);
        if (closeable == null) {
            return () -> requestContextStorage.pop(current, toRestore);
        } else {
            return () -> {
                closeable.close();
                requestContextStorage.pop(current, toRestore);
            };
        }
    }
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