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

com.alachisoft.ncache.common.caching.statistics.customcounters.NumberOfItemCounter Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.alachisoft.ncache.common.caching.statistics.customcounters;

/**
 * @author Muneeb Shahid
 */
public class NumberOfItemCounter extends PerformanceCounterBase {

    public NumberOfItemCounter(String name, String instance) {
        super(name, instance);
    }

    public NumberOfItemCounter(String category, String name, String instance) {
        super(category, name, instance);
    }

    @Override
    public void increment() {
        synchronized (this) {
            _value++;
        }
    }

    @Override
    public void incrementBy(double value) {
        synchronized (this) {
            _value += value;
        }
    }

    @Override
    public void decrement() {
        synchronized (this) {
            _value--;
        }
    }

    @Override
    public void decrementBy(double value) {
        synchronized (this) {
            _value -= value;
        }
    }

    @Override
    public double getValue() {
        return _value;
    }

    @Override
    public void setValue(double _value) {
        super._value = _value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy