Package org.xbib.metrics.common
Class Sampler.Context
- java.lang.Object
-
- org.xbib.metrics.common.Sampler.Context
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- Sampler
public static class Sampler.Context extends java.lang.Object implements java.io.CloseableA timing context.- See Also:
Sampler.time()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Equivalent to callingstop().longstop()Updates the sampler with the difference between current and start time.
-
-
-
Method Detail
-
stop
public long stop()
Updates the sampler with the difference between current and start time. Call to this method will not reset the start time. Multiple calls result in multiple updates.- Returns:
- the elapsed time in nanoseconds
-
close
public void close()
Equivalent to callingstop().- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-