public Double getValue()

in core/src/main/java/com/spotify/metrics/core/DerivedLongGauge.java [81:108]


    public Double getValue() {
        if (initial) {
            synchronized (lock) {
                if (initial) {
                    this.lastValue = getNext();
                    this.lastUpdate = timeProvider.currentTime();
                    this.initial = false;
                }
            }
        }

        final long currentTime = timeProvider.currentTime();

        if (currentTime - lastUpdate < minimalTimeStep) {
            return this.derived;
        }

        synchronized (lock) {
            if (currentTime - lastUpdate < minimalTimeStep) {
                return this.derived;
            }

            final Double derived = pollAndUpdate(currentTime);
            this.derived = derived;
            this.lastUpdate = currentTime;
            return this.derived;
        }
    }