com.hazelcast.util.counters
Interface Counter

All Known Implementing Classes:
MwCounter, SwCounter

public interface Counter

A Counter keeps track of a long value. It depends on the counter if increments are thread-safe. The get is thread-safe in the sense that it will see a recently published value. It doesn't need to mean that it will see the most recently published value.


Method Summary
 long get()
          Gets the current value.
 void inc()
          Increments the counter by one.
 void inc(int amount)
          Increments the counter by the given amount.
 

Method Detail

get

long get()
Gets the current value.

Returns:
the current value.

inc

void inc()
Increments the counter by one.


inc

void inc(int amount)
Increments the counter by the given amount. If the amount is negative, the counter is decremented.

Parameters:
amount - the amount to increase the counter with.


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