org.apache.commons.monitoring.impl.values
Class CompositeCounter
java.lang.Object
org.apache.commons.monitoring.impl.values.AbstractStatValue<Counter>
org.apache.commons.monitoring.impl.values.ThreadSafeCounter
org.apache.commons.monitoring.impl.values.CompositeCounter
- All Implemented Interfaces:
- Composite<Counter>, Counter, StatValue
public class CompositeCounter
- extends ThreadSafeCounter
- implements Composite<Counter>
A composite implementation of Counter that delegates to a primary
implementation and maintains a collection of secondary counters.
Typical use is to create monitoring graphs : On regular time intervals, a
new secondary counter is registered to computes stats for the current period,
and then removed.
- Author:
- Nicolas De Loof
| Methods inherited from class org.apache.commons.monitoring.impl.values.AbstractStatValue |
addListener, fireValueChanged, getHits, getMax, getMin, getMonitor, getRole, getStandardDeviation, getUnit, normalize, removeListener, setMonitor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.commons.monitoring.Counter |
getHits |
CompositeCounter
public CompositeCounter(Role<Counter> role)
getSecondary
public java.util.Collection<Counter> getSecondary()
- Specified by:
getSecondary in interface Composite<Counter>
- Returns:
- an (unmodifiable) collection of secondary instances
createSecondary
public Counter createSecondary()
- Description copied from interface:
Composite
- Create a secondary instance
- Specified by:
createSecondary in interface Composite<Counter>
removeSecondary
public void removeSecondary(Counter counter)
- Description copied from interface:
Composite
- Deregister a secondary instance
- Specified by:
removeSecondary in interface Composite<Counter>
add
public void add(long delta,
Unit unit)
- Description copied from interface:
Counter
- Add value to the counter. Delta should not be negative (in such case a Gauge should be used).
- Specified by:
add in interface Counter- Overrides:
add in class ThreadSafeCounter
set
public void set(long l,
Unit unit)
- Description copied from class:
ThreadSafeCounter
-
- Specified by:
set in interface StatValue- Overrides:
set in class ThreadSafeCounter
- Parameters:
l - the value to set
Copyright © 2008 The Apache Software Foundation. All Rights Reserved.