@Retention(value=RUNTIME) @Target(value=METHOD) public @interface CachedGauge
@CachedGauge(name = "queueSize", timeout = 30, timeoutUnit = TimeUnit.SECONDS)
public int getQueueSize() {
return queue.getSize();
}
A gauge for the defining class with the name queueSize will be created which uses the annotated method's
return value as its value, and which caches the result for 30 seconds.Modifier and Type | Required Element and Description |
---|---|
long |
timeout
The amount of time to cache the result
|
Modifier and Type | Optional Element and Description |
---|---|
boolean |
absolute
If
true , use the given name as an absolute name. |
String |
name
The name of the counter.
|
TimeUnit |
timeoutUnit
The unit of timeout
|
public abstract long timeout
public abstract String name
public abstract boolean absolute
true
, use the given name as an absolute name. If false
, use the given name
relative to the annotated class.public abstract TimeUnit timeoutUnit
Copyright © 2012-2013. All Rights Reserved.