- All Known Implementing Classes:
DefaultStatisticManager
public interface StatisticManager
A manager for statistics.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the statistics.default <RESULT,EXCEPTION extends Exception>
RESULTexecuteSql(Sql<?> sql, ThrowingSupplier<RESULT, EXCEPTION> supplier) Executes SQL and records the execution.Returns the statistics.booleanReturns whether this manager is enabled.voidrecordSqlExecution(Sql<?> sql, long startTimeNanos, long endTimeNanos) Records the execution of SQL.voidsetEnabled(boolean enabled) Sets whether this manager is enabled.
-
Method Details
-
isEnabled
boolean isEnabled()Returns whether this manager is enabled.- Returns:
- whether this manager is enabled
-
setEnabled
void setEnabled(boolean enabled) Sets whether this manager is enabled.- Parameters:
enabled- whether this manager is enabled
-
getStatistics
Returns the statistics.- Returns:
- the statistics
-
recordSqlExecution
Records the execution of SQL.- Parameters:
sql- the SQLstartTimeNanos- the start time in nanosecondsendTimeNanos- the end time in nanoseconds
-
executeSql
default <RESULT,EXCEPTION extends Exception> RESULT executeSql(Sql<?> sql, ThrowingSupplier<RESULT, EXCEPTION> supplier) throws EXCEPTIONExecutes SQL and records the execution.- Type Parameters:
RESULT- the result typeEXCEPTION- the exception type- Parameters:
sql- the SQLsupplier- the supplier- Returns:
- the result
- Throws:
EXCEPTION- the exception
-
clear
void clear()Clears the statistics.
-