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

io.quarkus.grpc.runtime.devmode.DevModeInterceptor Maven / Gradle / Ivy

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

import io.grpc.Metadata;
import io.grpc.ServerCall;
import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;

public class DevModeInterceptor implements ServerInterceptor {
    private final ClassLoader classLoader;

    public DevModeInterceptor(ClassLoader contextClassLoader) {
        classLoader = contextClassLoader;
    }

    @Override
    public  ServerCall.Listener interceptCall(ServerCall serverCall, Metadata metadata,
            ServerCallHandler next) {
        ClassLoader originalTccl = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);
        try {
            return next.startCall(serverCall, metadata);
        } finally {
            Thread.currentThread().setContextClassLoader(originalTccl);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy