public class CommandCounter
extends java.lang.Object
increment may exhibit unexpected behaviour.| Constructor and Description |
|---|
CommandCounter()
Construct a command counter using the default reset interval.
|
CommandCounter(long resetInterval)
Construct a command counter which ages command processing records out
based on the given reset interval (in milliseconds).
|
| Modifier and Type | Method and Description |
|---|---|
long |
getCount(CommandType type)
Get the total number of commands of the given type recorded by this
counter.
|
int |
getExactRecentTotal()
Get the total number of commands processed recently.
|
int |
getRecentCount(CommandType type)
Get the number of commands of the given type processed recently (within
the reset interval from now).
|
int |
getRecentTotal()
Get an approximation of the total number of commands processed
recently.
|
long |
getTotal()
Get the total number of commands of all types recorded by this counter.
|
void |
increment(CommandType type)
Increment the count of commands of the given type processed recently.
|
public CommandCounter()
public CommandCounter(long resetInterval)
resetInterval - the interval of time over which counts are taken.public void increment(CommandType type)
type - the type of command being processed.public int getRecentCount(CommandType type)
public long getCount(CommandType type)
public long getTotal()
public int getRecentTotal()
getExactTotal.public int getExactRecentTotal()