public abstract class Counter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
Counter.AtomicCounter |
private static class |
Counter.SerialCounter |
| Constructor and Description |
|---|
Counter() |
| Modifier and Type | Method and Description |
|---|---|
abstract long |
addAndGet(long delta)
Adds the given delta to the counters current value
|
abstract long |
get()
Returns the counters current value
|
static Counter |
newCounter()
Returns a new counter.
|
static Counter |
newCounter(boolean threadSafe)
Returns a new counter.
|
public abstract long addAndGet(long delta)
delta - the delta to addpublic abstract long get()
public static Counter newCounter()
public static Counter newCounter(boolean threadSafe)
threadSafe - true if the returned counter can be used by multiple
threads concurrently.