Class SqlStatistic
java.lang.Object
java.lang.Thread
clazzfish.core.util.ShutdownHook
clazzfish.monitor.AbstractMonitor
clazzfish.jdbc.AbstractStatistic
clazzfish.jdbc.SqlStatistic
- All Implemented Interfaces:
Shutdownable,AbstractStatisticMBean,SqlStatisticMBean,AbstractMonitorMBean,Runnable
This class monitors and measures SQL statements.
- Since:
- 0.9
- Author:
- oliver
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Method Summary
Modifier and TypeMethodDescriptionExports the SQL statistic as CSV.Returns the URI where the statistic should be exported to.static SqlStatisticvoidImports the statistics from the given URI.voidreset()To start a new statistic call this method.voidsetXPorter(CsvXPorter xPorter) static ProfileMonitorStart the monitor for the given SQL statement.static voidstop(ProfileMonitor mon, String command) Stops the given 'mon' and logs the given command with the needed time if debug is enabled.static voidstop(ProfileMonitor mon, String command, Object returnValue) Stops the given 'mon' and logs the given command with the needed time if debug is enabled.toString()As the toString implementation the name of the registered MBean is used.Methods inherited from class clazzfish.jdbc.AbstractStatistic
dumpMe, dumpMe, getCsvLines, getMaxAvg, getMaxAvgLabel, getMaxAvgStatistic, getMaxHits, getMaxHitsLabel, getMaxHitsStatistic, getMaxMax, getMaxMaxLabel, getMaxMaxStatistic, getMaxSize, getMaxTotal, getMaxTotalLabel, getMaxTotalStatistic, getMonitor, getMonitors, getSortedMonitors, getStatistics, logMe, resetRootMonitor, setMaxSize, startProfileMonitorForMethods inherited from class clazzfish.monitor.AbstractMonitor
copyResource, dump, dump, dumpArray, dumpArray, dumpHeadline, dumpMe, getDumpDir, isMBean, registerMeAsMBean, registerMeAsMBean, run, toStringArray, unregisterMeAsMBeanMethods inherited from class clazzfish.core.util.ShutdownHook
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHookMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, yieldMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface clazzfish.jdbc.AbstractStatisticMBean
getMaxAvg, getMaxAvgLabel, getMaxAvgStatistic, getMaxHits, getMaxHitsLabel, getMaxHitsStatistic, getMaxMax, getMaxMaxLabel, getMaxMaxStatistic, getMaxSize, getMaxTotal, getMaxTotalLabel, getMaxTotalStatistic, getStatistics, setMaxSizeMethods inherited from interface clazzfish.core.util.Shutdownable
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHook
-
Method Details
-
getInstance
-
getXPorter
-
setXPorter
-
reset
public void reset()To start a new statistic call this method. In contradiction toAbstractStatistic.reset()oldProfileMonitors will removed.- Specified by:
resetin interfaceAbstractStatisticMBean- Overrides:
resetin classAbstractStatistic
-
start
Start the monitor for the given SQL statement.- Parameters:
sql- the SQL statement to be monitored- Returns:
- the started profile monitor
-
stop
Stops the given 'mon' and logs the given command with the needed time if debug is enabled.- Parameters:
mon- the moncommand- the command
-
stop
Stops the given 'mon' and logs the given command with the needed time if debug is enabled.- Parameters:
mon- the monitorcommand- the SQL commandreturnValue- the monitored return value
-
exportCSV
Exports the SQL statistic as CSV.- Overrides:
exportCSVin classAbstractMonitor- Returns:
- the URI where the statistic is exported
- Throws:
IOException- in case of IO problems- Since:
- 3.0
-
getExportURI
Description copied from interface:SqlStatisticMBeanReturns the URI where the statistic should be exported to.- Specified by:
getExportURIin interfaceSqlStatisticMBean- Returns:
- export URI
-
importCSV
Imports the statistics from the given URI.- Parameters:
csvURI- URI where the statistic should be imported from
-
toString
Description copied from class:AbstractMonitorAs the toString implementation the name of the registered MBean is used.- Overrides:
toStringin classAbstractMonitor- Returns:
- the registered MBean name
-