public class SimpleLongCounter extends Facultative implements SimpleLongCounterMBean, LongCounter
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.AtomicLong |
count
Total number of calls
|
private java.util.concurrent.atomic.AtomicLong |
total
Total sum of samples
|
| Constructor and Description |
|---|
SimpleLongCounter() |
| Modifier and Type | Method and Description |
|---|---|
long |
getCount()
Get number of calls
|
long |
getTotal()
Get sum of samples
|
void |
print(java.lang.String file)
Print counters' values to the file
|
void |
print(java.lang.String comment,
java.lang.String file)
Print counters' values to the file
|
void |
reset()
Reset counters
|
java.lang.String |
toString(java.lang.String ts,
java.lang.String comment)
Return the string representation of the counter
|
void |
update(long value)
Update counter
|
enable, getAnnotation, isEnabled, register, setAnnotationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitenable, getAnnotation, isEnabled, setAnnotationdumpprivate final java.util.concurrent.atomic.AtomicLong total
private final java.util.concurrent.atomic.AtomicLong count
public void reset()
reset in interface SimpleLongCounterMBeanpublic long getTotal()
getTotal in interface SimpleLongCounterMBeanpublic long getCount()
getCount in interface SimpleLongCounterMBeanpublic void update(long value)
LongCounterupdate in interface LongCountervalue - new valueLongCounter.update(long)public void print(java.lang.String file)
throws java.io.IOException
print in interface SimpleLongCounterMBeanfile - output file name (will be appended if exists)java.io.IOException - on I/O errorpublic void print(java.lang.String comment,
java.lang.String file)
throws java.io.IOException
comment - commentfile - output file name (will be appended if exists)java.io.IOException - on I/O errorpublic java.lang.String toString(java.lang.String ts,
java.lang.String comment)
throws java.io.IOException
toString in interface LongCounterts - timestamp stringcomment - commentjava.io.IOException - on I/O error