001package org.javasimon.jmx;
002
003/**
004 * Interface for MX Bean representing a particular {@link org.javasimon.Counter}.
005 * It is not created by default when JMX is activated - it must be created explicitly.
006 * {@link JmxRegisterCallback} can be used to automate this.
007 *
008 * @author <a href="mailto:virgo47@gmail.com">Richard "Virgo" Richter</a>
009 */
010public interface CounterMXBean extends SimonSuperMXBean {
011
012        /**
013         * Increments the counter by one.
014         *
015         * @see org.javasimon.Counter#increase()
016         */
017        void increase();
018
019        /**
020         * Decrements the counter by one.
021         *
022         * @see org.javasimon.Counter#decrease()
023         */
024        void decrease();
025
026        /**
027         * Increments the counter by the specified value.
028         *
029         * @param inc added value
030         * @see org.javasimon.Counter#increase(long)
031         */
032        void increase(long inc);
033
034        /**
035         * Increments the counter by the specified value.
036         *
037         * @param dec subtracted value
038         * @see org.javasimon.Counter#decrease(long)
039         */
040        void decrease(long dec);
041
042        /**
043         * Returns the current value of the counter.
044         *
045         * @return counter value
046         * @see org.javasimon.Counter#getCounter()
047         * @since 3.3
048         */
049        long getCounter();
050
051        /**
052         * Returns minimal value of counter.
053         *
054         * @return maximal reached value
055         * @see org.javasimon.Counter#getMin()
056         * @since 3.3
057         */
058        long getMin();
059
060        /**
061         * Returns ms timestamp when the min value was reached.
062         *
063         * @return ms timestamp of the min value decremented
064         * @see org.javasimon.Counter#getMinTimestamp()
065         * @since 3.3
066         */
067        long getMinTimestamp();
068
069        /**
070         * Returns maximal value of counter.
071         *
072         * @return maximal reached value
073         * @see org.javasimon.Counter#getMax()
074         * @since 3.3
075         */
076        long getMax();
077
078        /**
079         * Returns ms timestamp when the max value was reached.
080         *
081         * @return ms timestamp of the max value incremented
082         * @see org.javasimon.Counter#getMaxTimestamp()
083         * @since 3.3
084         */
085        long getMaxTimestamp();
086
087        /**
088         * Sets the value of the counter to specified value.
089         *
090         * @param val new counter value
091         * @see org.javasimon.Counter#set(long)
092         */
093        void set(long val);
094
095        /**
096         * Returns the sum of all incremented values. If incremented value was negative, sum
097         * is lowered by this value.
098         *
099         * @return sum of all incremented values
100         * @see org.javasimon.Counter#getIncrementSum()
101         * @since 3.3
102         */
103        long getIncrementSum();
104
105        /**
106         * Returns the sum of all decremented values (as a positive number). If decremented value was negative, sum
107         * is lowered by this value.
108         *
109         * @return sum of all decremented values
110         * @see org.javasimon.Counter#getDecrementSum()
111         * @since 3.3
112         */
113        long getDecrementSum();
114
115        @Override
116        CounterSample sample();
117
118        @Override
119        CounterSample sampleIncrement(String key);
120}