Class StatTimer
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.context.stat.StatTimer
-
public class StatTimer extends java.lang.ObjectAbstraction aboveStopwatchto support inlined starts (when something tries to start already started timer). This is required when an initialization sequence could change and some blocks become part of already measured scope (in this case, such a measure should be simply ignored, as timer already counts it).- Since:
- 25.02.2025
-
-
Constructor Summary
Constructors Constructor Description StatTimer(com.google.common.base.Stopwatch stopwatch)Create timer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.base.StopwatchgetStopwatch()booleanisRunning()StatTimerstart()Start timer.voidstop()Stop timer.
-
-
-
Method Detail
-
start
public StatTimer start()
Start timer. Timer could be started multiple times (inlined scopes), but it must be stopped accordingly.- Returns:
- timer instance
-
stop
public void stop()
Stop timer. Could be called multiple times if inlined scopes.- Throws:
java.lang.IllegalStateException- if the timer already stopped
-
isRunning
public boolean isRunning()
- Returns:
- true if the timer is running
-
getStopwatch
public com.google.common.base.Stopwatch getStopwatch()
- Returns:
- underlying stopwatch
-
-