io.quarkus.grpc.runtime.supports.EventLoopBlockingCheckInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-grpc Show documentation
Show all versions of quarkus-grpc Show documentation
Serve and consume gRPC services
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);
}
}