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

io.quarkus.grpc.runtime.stork.StorkMeasuringCall Maven / Gradle / Ivy

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

import io.grpc.ClientCall;
import io.grpc.ForwardingClientCall;
import io.smallrye.stork.api.ServiceInstance;

abstract class StorkMeasuringCall extends ForwardingClientCall.SimpleForwardingClientCall
        implements StorkMeasuringCollector {
    final boolean recordTime;

    protected StorkMeasuringCall(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);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy