ru.tinkoff.kora.grpc.DynamicServerInterceptor Maven / Gradle / Ivy
package ru.tinkoff.kora.grpc;
import io.grpc.Metadata;
import io.grpc.ServerCall;
import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;
import ru.tinkoff.kora.application.graph.RefreshListener;
import ru.tinkoff.kora.application.graph.ValueOf;
public final class DynamicServerInterceptor implements ServerInterceptor, RefreshListener {
private volatile ServerInterceptor interceptor;
private final ValueOf interceptorNode;
public DynamicServerInterceptor(ValueOf interceptor) {
this.interceptorNode = interceptor;
this.interceptor = interceptor.get();
}
@Override
public ServerCall.Listener interceptCall(ServerCall call, Metadata headers, ServerCallHandler next) {
return interceptor.interceptCall(call, headers, next);
}
@Override
public void graphRefreshed() {
this.interceptor = interceptorNode.get();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy