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

com.ringcentral.platform.metrics.var.AbstractVar Maven / Gradle / Ivy

package com.ringcentral.platform.metrics.var;

import com.ringcentral.platform.metrics.AbstractMetric;
import com.ringcentral.platform.metrics.MetricInstance;
import com.ringcentral.platform.metrics.MetricListener;
import com.ringcentral.platform.metrics.labels.Label;
import com.ringcentral.platform.metrics.labels.LabelValue;
import com.ringcentral.platform.metrics.labels.LabelValues;
import com.ringcentral.platform.metrics.measurables.Measurable;
import com.ringcentral.platform.metrics.names.MetricName;
import com.ringcentral.platform.metrics.var.configs.VarConfig;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Supplier;

import static com.ringcentral.platform.metrics.labels.LabelValues.NO_LABEL_VALUES;
import static com.ringcentral.platform.metrics.utils.Preconditions.checkArgument;
import static java.util.Collections.emptyList;

public abstract class AbstractVar extends AbstractMetric implements Var {

    public interface InstanceMaker {
        VarInstance makeInstance(
            MetricName name,
            List labelValues,
            boolean totalInstance,
            boolean labeledMetricTotalInstance,
            boolean nonDecreasing,
            Measurable valueMeasurable,
            Supplier valueSupplier);
    }

    private final VarConfig config;
    private final boolean nonDecreasing;

    private volatile boolean removed;
    private final List listeners = new ArrayList<>();

    private final LabelValues prefixLabelValues;
    private final List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy