Class Watches
-
- All Implemented Interfaces:
public class WatchesPerformance Monitoring
- Since:
2022-11-21
trydofor
-
-
Field Summary
Fields Modifier and Type Field Description public final static Loggerlog
-
Constructor Summary
Constructors Constructor Description Watches()
-
Method Summary
Modifier and Type Method Description static StopWatchacquire()acquire and release with try-close style static StopWatch.Watchacquire(String name)static StopWatchcurrent()Get the StopWatch at the current thread. static StopWatch.Watchcurrent(String name)Get the StopWatch at the current thread. static booleanrelease(boolean clean)Release the current timer and returns whether all timers have finished. static booleanrelease(boolean clean, @Nullable() String token)Release the current timer and returns whether all timers have finished. static booleanrelease(boolean clean, @Nullable() String token, @NotNull() BiConsumer<String, StopWatch> handle)Release the current timer and returns whether all timers have finished. static voidsetWatchHandler(BiConsumer<String, StopWatch> handler)to handle the StopWatch when timings are finished and token is not null. -
-
Method Detail
-
acquire
@NotNull() static StopWatch acquire()
acquire and release with try-close style
-
current
@Nullable() static StopWatch current()
Get the StopWatch at the current thread.
-
current
@Nullable() static StopWatch.Watch current(String name)
Get the StopWatch at the current thread.
-
release
static boolean release(boolean clean)
Release the current timer and returns whether all timers have finished. When all timings are finished, clear the watches if clean.
-
release
static boolean release(boolean clean, @Nullable() String token)
Release the current timer and returns whether all timers have finished. When all timings are finished, handle the StopWatch if token is not null, clear the watches if clean.
-
release
static boolean release(boolean clean, @Nullable() String token, @NotNull() BiConsumer<String, StopWatch> handle)
Release the current timer and returns whether all timers have finished. When all timings are finished, handle the StopWatch if token is not null, clear the watches if clean.
-
setWatchHandler
static void setWatchHandler(BiConsumer<String, StopWatch> handler)
to handle the StopWatch when timings are finished and token is not null. should handle the StopWatch before its clean.
- Parameters:
handler- token and StopWatch are not null
-
-
-
-