Class SqlStatistic

All Implemented Interfaces:
Shutdownable, AbstractStatisticMBean, SqlStatisticMBean, AbstractMonitorMBean, Runnable

public class SqlStatistic extends AbstractStatistic implements SqlStatisticMBean
This class monitors and measures SQL statements.
Since:
0.9
Author:
oliver
  • Method Details

    • getInstance

      public static SqlStatistic getInstance()
    • getXPorter

      public CsvXPorter getXPorter()
    • setXPorter

      public void setXPorter(CsvXPorter xPorter)
    • reset

      public void reset()
      To start a new statistic call this method. In contradiction to AbstractStatistic.reset() old ProfileMonitors will removed.
      Specified by:
      reset in interface AbstractStatisticMBean
      Overrides:
      reset in class AbstractStatistic
    • start

      public static ProfileMonitor start(String sql)
      Start the monitor for the given SQL statement.
      Parameters:
      sql - the SQL statement to be monitored
      Returns:
      the started profile monitor
    • stop

      public static void stop(ProfileMonitor mon, String command)
      Stops the given 'mon' and logs the given command with the needed time if debug is enabled.
      Parameters:
      mon - the mon
      command - the command
    • stop

      public static void stop(ProfileMonitor mon, String command, Object returnValue)
      Stops the given 'mon' and logs the given command with the needed time if debug is enabled.
      Parameters:
      mon - the monitor
      command - the SQL command
      returnValue - the monitored return value
    • exportCSV

      public URI exportCSV() throws IOException
      Exports the SQL statistic as CSV.
      Overrides:
      exportCSV in class AbstractMonitor
      Returns:
      the URI where the statistic is exported
      Throws:
      IOException - in case of IO problems
      Since:
      3.0
    • getExportURI

      public URI getExportURI()
      Description copied from interface: SqlStatisticMBean
      Returns the URI where the statistic should be exported to.
      Specified by:
      getExportURI in interface SqlStatisticMBean
      Returns:
      export URI
    • importCSV

      public void importCSV(URI csvURI)
      Imports the statistics from the given URI.
      Parameters:
      csvURI - URI where the statistic should be imported from
    • toString

      public String toString()
      Description copied from class: AbstractMonitor
      As the toString implementation the name of the registered MBean is used.
      Overrides:
      toString in class AbstractMonitor
      Returns:
      the registered MBean name