static ServiceRequestContext current() {
        final RequestContext ctx = RequestContext.current();
        final ServiceRequestContext root = ctx.root();
        if (root != null) {
            return root;
        }

        throw new IllegalStateException(
                "The current context is not a server-side context and does not have a root " +
                "which means that the context is not invoked by a server request. ctx: " + ctx);
    }
Returns the server-side context of the {@link Request} that is being handled in the current thread.
If the context is a {@link ClientRequestContext}, {@link ClientRequestContext#root()} is returned.

@throws IllegalStateException if the context is unavailable in the current thread or
                              the current context is a {@link ClientRequestContext} and
                              {@link ClientRequestContext#root()} is {@code null}
core/src/main/java/com/linecorp/armeria/server/ServiceRequestContext.java