Class SQLTraceCache

  • Direct Known Subclasses:
    FrequentSQLTraceCache, SlowSqlTraceCache

    public abstract class SQLTraceCache
    extends Object
    Base class for Sql Tracing Caches used to store SQL statements used by applications.
    Author:
    Shalini M
    • Constructor Detail

      • SQLTraceCache

        public SQLTraceCache​(String poolName,
                             int maxSize,
                             long timeToKeepQueries)
    • Method Detail

      • getPoolName

        public String getPoolName()
      • scheduleTimerTask

        public void scheduleTimerTask​(Timer timer)
        Schedule timer to perform purgeEntries on the cache after the specified timeToKeepQueries delay and period.
        Parameters:
        timer -
      • cancelTimerTask

        public void cancelTimerTask()
        Cancel the timer task used to perform a purgeEntries on the cache.
      • checkAndUpdateCache

        public abstract 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.
        Parameters:
        cacheObj -
      • purgeEntries

        public void purgeEntries()
        Entries are removed from the list after sorting them in the least frequently used order. Only numTopQueriesToReport number of entries are maintained in the list after the purgeEntries.