io.quarkus.grpc.runtime.stork.AbstractStorkMeasuringCall 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.stork;
import io.grpc.ClientCall;
import io.grpc.ForwardingClientCall;
import io.smallrye.stork.api.ServiceInstance;
abstract class AbstractStorkMeasuringCall extends ForwardingClientCall.SimpleForwardingClientCall
implements StorkMeasuringCollector {
final boolean recordTime;
protected AbstractStorkMeasuringCall(ClientCall delegate, boolean recordTime) {
super(delegate);
this.recordTime = recordTime;
}
protected abstract ServiceInstance serviceInstance();
public void recordReply() {
if (serviceInstance() != null && recordTime) {
serviceInstance().recordReply();
}
}
public void recordEnd(Throwable error) {
if (serviceInstance() != null) {
serviceInstance().recordEnd(error);
}
}
}