All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.grpc.runtime.supports.EventLoopBlockingCheckInterceptor Maven / Gradle / Ivy

There is a newer version: 3.15.1
Show newest version
package io.quarkus.grpc.runtime.supports;

import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
import io.grpc.MethodDescriptor;
import io.vertx.core.Context;

public class EventLoopBlockingCheckInterceptor implements ClientInterceptor {
    @Override
    public  ClientCall interceptCall(MethodDescriptor method, CallOptions callOptions,
            Channel next) {
        if (Context.isOnEventLoopThread()) {
            throw new IllegalStateException("Blocking gRPC client call made from the event loop. " +
                    "If the code is executed from a gRPC service or a RESTEasy Reactive resource, either annotate the method " +
                    " that makes the call with `@Blocking` or use the non-blocking client.");
        }
        return next.newCall(method, callOptions);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy