Class SlowQueryReport

    • Constructor Detail

      • SlowQueryReport

        public SlowQueryReport()
        Creates a slow query report interceptor
    • Method Detail

      • getPoolStats

        public static ConcurrentHashMap<String,​SlowQueryReport.QueryStats> getPoolStats​(String poolname)
        Returns the query stats for a given pool
        Parameters:
        poolname - - the name of the pool we want to retrieve stats for
        Returns:
        a hash map containing statistics for 0 to maxQueries
      • setMaxQueries

        public void setMaxQueries​(int maxQueries)
      • reportQuery

        protected String reportQuery​(String query,
                                     Object[] args,
                                     String name,
                                     long start,
                                     long delta)
        Description copied from class: AbstractQueryReport
        Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold
        Overrides:
        reportQuery in class AbstractQueryReport
        Parameters:
        query - the query that was executed and failed
        args - the arguments to the execution
        name - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the time the query execution started
        delta - the time the execution took
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution
      • reportSlowQuery

        protected String reportSlowQuery​(String query,
                                         Object[] args,
                                         String name,
                                         long start,
                                         long delta)
        Description copied from class: AbstractQueryReport
        Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold
        Overrides:
        reportSlowQuery in class AbstractQueryReport
        Parameters:
        query - the query that was executed and failed
        args - the arguments to the execution
        name - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the time the query execution started
        delta - the time the execution took
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution
      • prepareStatement

        public void prepareStatement​(String sql,
                                     long time)
        Description copied from class: AbstractQueryReport
        Invoked when prepareStatement has been called and completed.
        Specified by:
        prepareStatement in class AbstractQueryReport
        Parameters:
        sql - - the string used to prepare the statement with
        time - - the time it took to invoke prepare
      • prepareCall

        public void prepareCall​(String sql,
                                long time)
        Description copied from class: AbstractQueryReport
        Invoked when prepareCall has been called and completed.
        Specified by:
        prepareCall in class AbstractQueryReport
        Parameters:
        sql - - the string used to prepare the statement with
        time - - the time it took to invoke prepare
      • poolStarted

        public void poolStarted​(ConnectionPool pool)
        This method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested. Interceptor classes can override this method if they keep static variables or other tracking means around. This method is only invoked on a single instance of the interceptor, and not on every instance created.
        Overrides:
        poolStarted in class JdbcInterceptor
        Parameters:
        pool - - the pool that is being closed.
      • poolClosed

        public void poolClosed​(ConnectionPool pool)
        This method is invoked by a connection pool when the pool is closed. Interceptor classes can override this method if they keep static variables or other tracking means around. This method is only invoked on a single instance of the interceptor, and not on every instance created.
        Overrides:
        poolClosed in class JdbcInterceptor
        Parameters:
        pool - - the pool that is being closed.
      • isLogSlow

        public boolean isLogSlow()
      • setLogSlow

        public void setLogSlow​(boolean logSlow)
      • isLogFailed

        public boolean isLogFailed()
      • setLogFailed

        public void setLogFailed​(boolean logFailed)
      • setProperties

        public void setProperties​(Map<String,​PoolProperties.InterceptorProperty> properties)
        Description copied from class: JdbcInterceptor
        Called during the creation of an interceptor The properties can be set during the configuration of an interceptor Override this method to perform type casts between string values and object properties
        Overrides:
        setProperties in class JdbcInterceptor
        Parameters:
        properties - The properties