net.sf.ehcache.distribution.jgroups.jmx
Class AtomicRate
java.lang.Object
net.sf.ehcache.distribution.jgroups.jmx.AtomicRate
public final class AtomicRate
- extends Object
Tracks a rate (counter / time) using a bucket based approach to reduce overhead.
This is thread safe
- Author:
- Eric Dalquist
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AtomicRate
public AtomicRate(int duration,
TimeUnit unit)
- Parameters:
duration - Duration the rate spansunit - The time unit for the duration
getRateUnit
public TimeUnit getRateUnit()
- Returns:
- The
TimeUnit the rate is over
getRateDuration
public long getRateDuration()
- Returns:
- The duration the rate covers, returned in the scale of the
getRateUnit()
count
public void count()
- Increment the counter
getRate
public double getRate()
- Returns:
- The current rate. The rate returned is in the
TimeUnit used provided in the constructor.
Copyright © 2003-2012 Terracotta, Inc.. All Rights Reserved.