public final class BasicCounter extends Object implements CounterSupplier
CounterSupplier.
Counters must be started before they are first incremented.
Once they have stopped they cannot be started again.| Constructor and Description |
|---|
BasicCounter()
Creates a counter with an initial count of 0.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getCount()
This will return the value of the counter or an undefined value if never started.
|
StatisticState |
getState()
Returns the current state of the supplier.
|
void |
increment()
Increments the counter by
1 |
void |
increment(long stepSize)
Increments the counter by the specified step size
|
CounterSupplier |
snapshot()
Returns a snapshot of this statistic.
|
void |
start()
Places the counter in the
StatisticState.ACTIVE. |
void |
stop()
Places the counter in the stopped state.
|
public BasicCounter()
increment() for the first time,
start() must be called.public void start()
StatisticState.ACTIVE.IllegalStateException - if the counter is already
started or has finishedpublic void stop()
finally block.public StatisticState getState()
StatisticSuppliergetState in interface StatisticSupplierpublic void increment()
1public void increment(long stepSize)
stepSize - the amount by which to incrementpublic CounterSupplier snapshot()
StatisticSuppliersnapshot in interface CounterSuppliersnapshot in interface StatisticSupplierpublic long getCount()
CounterSuppliergetCount in interface CounterSupplierCopyright © 2016 Actian Corporation. All rights reserved.