Package com.sun.gjc.util
Class SQLTraceCache
- java.lang.Object
-
- com.sun.gjc.util.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
-
-
Field Summary
Fields Modifier and Type Field Description protected static Logger
_logger
protected ConcurrentSkipListMap<String,SQLTrace>
cache
protected static String
LINE_BREAK
protected int
numTopQueriesToReport
protected String
poolName
protected long
timeToKeepQueries
-
Constructor Summary
Constructors Constructor Description SQLTraceCache(String poolName, int maxSize, long timeToKeepQueries)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cancelTimerTask()
Cancel the timer task used to perform a purgeEntries on the cache.abstract void
checkAndUpdateCache(SQLTrace cacheObj)
Request for adding a sql query in the form of SQLTrace to this cache.String
getPoolName()
Collection<String>
getSqlTraceList()
void
purgeEntries()
Entries are removed from the list after sorting them in the least frequently used order.void
scheduleTimerTask(Timer timer)
Schedule timer to perform purgeEntries on the cache after the specified timeToKeepQueries delay and period.
-
-
-
Field Detail
-
numTopQueriesToReport
protected int numTopQueriesToReport
-
timeToKeepQueries
protected long timeToKeepQueries
-
poolName
protected final String poolName
-
cache
protected ConcurrentSkipListMap<String,SQLTrace> cache
-
_logger
protected static final Logger _logger
-
LINE_BREAK
protected static final String LINE_BREAK
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SQLTraceCache
public SQLTraceCache(String poolName, int maxSize, long timeToKeepQueries)
-
-
Method Detail
-
getSqlTraceList
public Collection<String> getSqlTraceList()
-
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.
-
-