Class DatabaseTiming


  • public class DatabaseTiming
    extends java.lang.Object
    A class to capture timing and record counts for database operations
    Author:
    Xavier Witdouck
    • Constructor Summary

      Constructors 
      Constructor Description
      DatabaseTiming()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DatabaseTiming reset()
      Resets this timing entity
      (package private) <T> T timeConnect​(java.util.concurrent.Callable<T> callable)
      Times a callable and tags the resulting time as connect time
      (package private) <T> T timeQuery​(java.util.concurrent.Callable<T> callable)
      Times a callable and tags the resulting time as query time
      (package private) <T> T timeResultSet​(java.util.concurrent.Callable<T> callable)
      Times a callable and tags the resulting time as result set time
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • connectMillis

        private long connectMillis
      • queryMillis

        private long queryMillis
      • resultSetMillis

        private long resultSetMillis
    • Constructor Detail

      • DatabaseTiming

        public DatabaseTiming()
    • Method Detail

      • reset

        public DatabaseTiming reset()
        Resets this timing entity
        Returns:
        this timing entity
      • timeConnect

        <T> T timeConnect​(java.util.concurrent.Callable<T> callable)
        Times a callable and tags the resulting time as connect time
        Type Parameters:
        T - the type for callable
        Parameters:
        callable - the callable to run
        Returns:
        the result of callable
      • timeQuery

        <T> T timeQuery​(java.util.concurrent.Callable<T> callable)
        Times a callable and tags the resulting time as query time
        Type Parameters:
        T - the type for callable
        Parameters:
        callable - the callable to run
        Returns:
        the result of callable
      • timeResultSet

        <T> T timeResultSet​(java.util.concurrent.Callable<T> callable)
        Times a callable and tags the resulting time as result set time
        Type Parameters:
        T - the type for callable
        Parameters:
        callable - the callable to run
        Returns:
        the result of callable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object