Package org.apache.jackrabbit.oak.stats
Class StopwatchLogger
- java.lang.Object
-
- org.apache.jackrabbit.oak.stats.StopwatchLogger
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class StopwatchLogger extends Object implements Closeable
Utility class to be used for tracking of timing within methods. It makes use of theClock.Fastfor speeding up the operation.
-
-
Constructor Summary
Constructors Constructor Description StopwatchLogger(@NotNull Class<?> clazz)instantiate a class with the provided classStopwatchLogger(@NotNull String clazz)Create a class with the provided class.StopwatchLogger(@Nullable Logger customLog, @NotNull Class<?> clazz)Instantiate a class with the provided class and custom logger.StopwatchLogger(@Nullable Logger customLog, @NotNull String clazz)Instantiate a class with the provided class and custom logger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisEnabled()booleanisStarted()voidsplit(@Nullable String message)track of an intermediate time without stopping the ticking.voidstart()starts the clockvoidstop(@Nullable String message)track the time and stop the clock.
-
-
-
Constructor Detail
-
StopwatchLogger
public StopwatchLogger(@NotNull @NotNull String clazz)Create a class with the provided class.- Parameters:
clazz-
-
StopwatchLogger
public StopwatchLogger(@NotNull @NotNull Class<?> clazz)instantiate a class with the provided class- Parameters:
clazz-
-
StopwatchLogger
public StopwatchLogger(@Nullable @Nullable Logger customLog, @NotNull @NotNull Class<?> clazz)Instantiate a class with the provided class and custom logger. The provided logger, if not null, will be then used for tracking down times- Parameters:
customLog-clazz-
-
-
Method Detail
-
start
public void start()
starts the clock
-
split
public void split(@Nullable @Nullable String message)track of an intermediate time without stopping the ticking.- Parameters:
message-
-
stop
public void stop(@Nullable @Nullable String message)track the time and stop the clock.- Parameters:
message-
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isStarted
public boolean isStarted()
- Returns:
- true if the clock has been started. False otherwise.
-
isEnabled
public boolean isEnabled()
- Returns:
- true whether the provided appender has DEBUG enabled and therefore asked to track times.
-
-