Class FrequentSQLTraceCache


  • public class FrequentSQLTraceCache
    extends SQLTraceCache
    Maintains the Sql Tracing Cache used to store SQL statements used by the applications. This is used by the JDBCRA monitoring to display the most frequently used queries by applications.
    Author:
    Shalini M
    • Field Detail

      • maxStoredEntries

        protected long maxStoredEntries
    • Constructor Detail

      • FrequentSQLTraceCache

        public FrequentSQLTraceCache​(String poolName,
                                     int numToReport,
                                     long timeToKeepQueries)
      • FrequentSQLTraceCache

        public FrequentSQLTraceCache​(String poolName,
                                     int numToReport,
                                     long timeToKeepQueries,
                                     long maxStoredEntries)
    • Method Detail

      • checkAndUpdateCache

        public void checkAndUpdateCache​(SQLTrace cacheObj)
        Request for adding a sql query in the form of SQLTrace to this cache. If the query is already found in the list, the number of times it is executed is incremented by one along with the timestamp. If the query is a new one, it is added to the list.
        Specified by:
        checkAndUpdateCache in class SQLTraceCache
        Parameters:
        cacheObj -
      • getTopQueries

        public List<SQLTrace> getTopQueries()
        Returns the String representation of the list of traced sql queries ordered by the number most frequently used, followed by the usage timestamp. Only the top 'n' queries represented by the numTopQueriesToReport are chosen for display.
        Returns:
        string representation of the list of sql queries sorted