org.terracotta.counter
Interface Counter

All Superinterfaces:
Statistic
All Known Implementing Classes:
BoundedCounter, SimpleCounterImpl

public interface Counter
extends Statistic

A simple long based counter.


Method Summary
 long decrement()
          Decrements the count by one.
 long decrement(long amount)
          Decrements the count by amount.
 long getAndSet(long newValue)
          Set the count to the supplied value, and return the old value.
 long increment()
          Increments the count by one.
 long increment(long amount)
          Increments the count by amount.
 void setValue(long newValue)
          Set the count to the supplied value.
 
Methods inherited from interface org.terracotta.counter.Statistic
getAndReset, getValue
 

Method Detail

increment

long increment()
Increments the count by one.

Returns:
the new count value

decrement

long decrement()
Decrements the count by one.

Returns:
the new count value

getAndSet

long getAndSet(long newValue)
Set the count to the supplied value, and return the old value.

Implementations of this method need not be atomic, all though this method is obviously of little value if the implementation is not atomic.

Parameters:
newValue - value to set to
Returns:
the old value

increment

long increment(long amount)
Increments the count by amount.

Parameters:
amount - amount to increment by
Returns:
the new value

decrement

long decrement(long amount)
Decrements the count by amount.

Parameters:
amount - amount to increment by
Returns:
the new value

setValue

void setValue(long newValue)
Set the count to the supplied value.

Parameters:
newValue - value to set to


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.