On Mon, Nov 27, 2023 at 3:02 PM John Wilson wrote:
> Is this implementation correct?
>
Looks fine.
Is this thread safe?
>
Context is immutable (although the values could be mutable, but then you'd
be responsible for synchronization). And the "current" Context is stored in
a ThreadLocal. So,
Hi Grpc team!
I have a ServerInterceptor instance for my grpc server, it does something
like this:
@Override
public ServerCall.Listener interceptCall(
ServerCall call, Metadata headers,
ServerCallHandler next) {
Context context = Context.current();
// more
Hi Grpc team!
I have a ServerInterceptor instance for my grpc server, it does something
like this:
@Override
public ServerCall.Listener interceptCall(
ServerCall call, Metadata headers,
ServerCallHandler next) {
Context context = Context.current();
//
Hi Edu,
Yes, that implementation looks good. We have an example that does
something similar:
https://github.com/grpc/grpc-java/tree/master/examples/example-oauth
ServerInterceptors are called sequentially by a single thread, so it will
be thread safe. Additionally, Context objects are
Hi Grpc team!
I have a ServerInterceptor instance for my grpc server, it does something
like this:
@Override
public ServerCall.Listener interceptCall(
ServerCall call, Metadata headers,
ServerCallHandler next) {
Context context = Context.current();
// more