public class CounterMXBeanImpl extends AbstractSimonMXBeanImpl implements CounterMXBean
Counter. It is not created
by default when JMX is activated - it must be created explicitly.
JmxRegisterCallback can be used to automate this.
Class can be subclassed to override default behavior if desired, counter is declared protected for this reason.| Modifier and Type | Field and Description |
|---|---|
protected Counter |
counter
Wrapped
Counter instance - protected for subclasses. |
| Constructor and Description |
|---|
CounterMXBeanImpl(Counter counter)
Creates the MX bean for the provided Counter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decrease()
Decrements the counter by one.
|
void |
decrease(long dec)
Increments the counter by the specified value.
|
long |
getCounter()
Returns the current value of the counter.
|
long |
getDecrementSum()
Returns the sum of all decremented values (as a positive number).
|
long |
getIncrementSum()
Returns the sum of all incremented values.
|
long |
getMax()
Returns maximal value of counter.
|
long |
getMaxTimestamp()
Returns ms timestamp when the max value was reached.
|
long |
getMin()
Returns minimal value of counter.
|
long |
getMinTimestamp()
Returns ms timestamp when the min value was reached.
|
String |
getType()
Returns Simon type used as a property in the
ObjectName. |
void |
increase()
Increments the counter by one.
|
void |
increase(long inc)
Increments the counter by the specified value.
|
CounterSample |
sample()
Samples Simon values and returns them in a Java Bean derived from Sample interface.
|
CounterSample |
sampleIncrement(String key)
Samples increment in Simon values since the previous call of this method with the
same key.
|
void |
set(long val)
Sets the value of the counter to specified value.
|
protected Simon |
simon()
Returns the wrapped Simon.
|
boolean |
stopIncrementalSampling(String key)
Stops incremental sampling for the key, removing any internal information for the key.
|
getChildrenNames, getFirstUsage, getFirstUsageAsString, getLastUsage, getLastUsageAsString, getName, getNote, getParentName, getState, isEnabled, setNote, setStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetChildrenNames, getFirstUsage, getFirstUsageAsString, getLastUsage, getLastUsageAsString, getName, getNote, getParentName, getState, isEnabled, setNote, setStatepublic CounterMXBeanImpl(Counter counter)
counter - wrapped Counterpublic final void increase()
CounterMXBeanincrease in interface CounterMXBeanCounter.increase()public final void decrease()
CounterMXBeandecrease in interface CounterMXBeanCounter.decrease()public final void increase(long inc)
CounterMXBeanincrease in interface CounterMXBeaninc - added valueCounter.increase(long)public final void decrease(long dec)
CounterMXBeandecrease in interface CounterMXBeandec - subtracted valueCounter.decrease(long)public long getMaxTimestamp()
CounterMXBeangetMaxTimestamp in interface CounterMXBeanCounter.getMaxTimestamp()public long getMax()
CounterMXBeangetMax in interface CounterMXBeanCounter.getMax()public long getMinTimestamp()
CounterMXBeangetMinTimestamp in interface CounterMXBeanCounter.getMinTimestamp()public long getMin()
CounterMXBeangetMin in interface CounterMXBeanCounter.getMin()public long getCounter()
CounterMXBeangetCounter in interface CounterMXBeanCounter.getCounter()public final void set(long val)
CounterMXBeanset in interface CounterMXBeanval - new counter valueCounter.set(long)public long getIncrementSum()
CounterMXBeangetIncrementSum in interface CounterMXBeanCounter.getIncrementSum()public long getDecrementSum()
CounterMXBeangetDecrementSum in interface CounterMXBeanCounter.getDecrementSum()public final CounterSample sample()
SimonSuperMXBeansample in interface CounterMXBeansample in interface SimonSuperMXBeanpublic CounterSample sampleIncrement(String key)
SimonSuperMXBeanSimonSuperMXBean.sample(). Any subsequent calls with the key
provide increments.
Clients should use a unique key (GUID, host name, etc.), to avoid interference
with other clients.sampleIncrement in interface CounterMXBeansampleIncrement in interface SimonSuperMXBeankey - key used to access incremental sampleSample with value incrementspublic final String getType()
SimonSuperMXBeanObjectName.getType in interface SimonSuperMXBeanpublic boolean stopIncrementalSampling(String key)
SimonSuperMXBeanSimonSuperMXBean.sampleIncrement(String) for the key will be considered the first
call for the key.stopIncrementalSampling in interface SimonSuperMXBeankey - key used to access incremental sampleprotected final Simon simon()
AbstractSimonMXBeanImplsimon in class AbstractSimonMXBeanImplCopyright © 2019. All rights reserved.