Package org.quartz.utils.counter
Class CounterImpl
- java.lang.Object
-
- org.quartz.utils.counter.CounterImpl
-
- All Implemented Interfaces:
java.io.Serializable
,Counter
- Direct Known Subclasses:
SampledCounterImpl
public class CounterImpl extends java.lang.Object implements Counter, java.io.Serializable
A simple counter implementation- Since:
- 1.8
- Author:
- Abhishek Sanoujam
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CounterImpl()
Default ConstructorCounterImpl(long initialValue)
Constructor with initial value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
decrement()
Decrement the counter by 1long
decrement(long amount)
Decrement the counter by given amountlong
getAndSet(long newValue)
Returns the value of the counter and sets it to the new valuelong
getValue()
Gets current value of the counterlong
increment()
Increment the counter by 1long
increment(long amount)
Increment the counter by given amountvoid
setValue(long newValue)
Sets the value of the counter to the supplied value
-
-
-
Method Detail
-
increment
public long increment()
Increment the counter by 1
-
decrement
public long decrement()
Decrement the counter by 1
-
getAndSet
public long getAndSet(long newValue)
Returns the value of the counter and sets it to the new value
-
getValue
public long getValue()
Gets current value of the counter
-
increment
public long increment(long amount)
Increment the counter by given amount
-
decrement
public long decrement(long amount)
Decrement the counter by given amount
-
-