public abstract class AbstractTimer extends java.lang.Object implements Timer
Timer.Builder
Meter.Type
Modifier and Type | Field and Description |
---|---|
protected Clock |
clock |
protected MeterId |
id |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTimer(MeterId id,
Clock clock) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
java.lang.Iterable<Tag> |
getTags() |
void |
record(java.lang.Runnable f)
Executes the runnable `f` and records the time taken.
|
<T> T |
record(java.util.function.Supplier<T> f)
Executes the Supplier `f` and records the time taken.
|
<T> T |
recordCallable(java.util.concurrent.Callable<T> f)
Executes the callable `f` and records the time taken.
|
<T> java.util.concurrent.Callable<T> |
wrap(java.util.concurrent.Callable<T> f)
Wrap a
Callable so that it is timed when invoked. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public <T> T recordCallable(java.util.concurrent.Callable<T> f) throws java.lang.Exception
Timer
recordCallable
in interface Timer
f
- Function to execute and measure the execution time.java.lang.Exception
public <T> T record(java.util.function.Supplier<T> f)
Timer
public <T> java.util.concurrent.Callable<T> wrap(java.util.concurrent.Callable<T> f)
Timer
Callable
so that it is timed when invoked.public void record(java.lang.Runnable f)
Timer