com.continuent.tungsten.replicator.prefetch
Class SlowQueryCache

java.lang.Object
  extended by com.continuent.tungsten.replicator.prefetch.SlowQueryCache

public class SlowQueryCache
extends java.lang.Object

Implements a shared cache for slow prefetch queries. The cache supports concurrent access by synchronizing all access. Methods within the cache are relatively fast.


Constructor Summary
SlowQueryCache()
           
 
Method Summary
 int getSlowQueryCacheDuration()
          Returns the slowQueryCacheDuration value.
 int getSlowQueryCacheSize()
          Returns the slowQueryCacheSize value.
 int getSlowQueryRows()
          Returns the slowQueryRows value.
 double getSlowQuerySelectivity()
          Returns the slowQuerySelectivity value.
 void init()
          Initialize the cache.
 void setSlowQueryCacheDuration(int slowQueryCacheDuration)
          Sets the slowQueryCacheDuration value.
 void setSlowQueryCacheSize(int slowQueryCacheSize)
          Sets the slowQueryCacheSize value.
 void setSlowQueryRows(int slowQueryRows)
          Sets the slowQueryRows value.
 void setSlowQuerySelectivity(double slowQuerySelectivity)
          Sets the slowQuerySelectivity value.
 boolean shouldExecute(KeySelect keySelect)
          Returns true if we have not heard of this query *or* if the query has exceeded the slow query limit.
 java.lang.String toString()
          
 void updateCache(KeySelect keySelect, long rowCount)
          Check for a slow query and update cache accordingly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SlowQueryCache

public SlowQueryCache()
Method Detail

getSlowQueryCacheSize

public int getSlowQueryCacheSize()
Returns the slowQueryCacheSize value.

Returns:
Returns the slowQueryCacheSize.

setSlowQueryCacheSize

public void setSlowQueryCacheSize(int slowQueryCacheSize)
Sets the slowQueryCacheSize value.

Parameters:
slowQueryCacheSize - The slowQueryCacheSize to set.

getSlowQueryRows

public int getSlowQueryRows()
Returns the slowQueryRows value.

Returns:
Returns the slowQueryRows.

setSlowQueryRows

public void setSlowQueryRows(int slowQueryRows)
Sets the slowQueryRows value.

Parameters:
slowQueryRows - The slowQueryRows to set.

getSlowQuerySelectivity

public double getSlowQuerySelectivity()
Returns the slowQuerySelectivity value.

Returns:
Returns the slowQuerySelectivity.

setSlowQuerySelectivity

public void setSlowQuerySelectivity(double slowQuerySelectivity)
Sets the slowQuerySelectivity value.

Parameters:
slowQuerySelectivity - The slowQuerySelectivity to set.

getSlowQueryCacheDuration

public int getSlowQueryCacheDuration()
Returns the slowQueryCacheDuration value.

Returns:
Returns the slowQueryCacheDuration.

setSlowQueryCacheDuration

public void setSlowQueryCacheDuration(int slowQueryCacheDuration)
Sets the slowQueryCacheDuration value.

Parameters:
slowQueryCacheDuration - The slowQueryCacheDuration to set.

init

public void init()
Initialize the cache.


shouldExecute

public boolean shouldExecute(KeySelect keySelect)
Returns true if we have not heard of this query *or* if the query has exceeded the slow query limit.

Throws:
java.sql.SQLException

updateCache

public void updateCache(KeySelect keySelect,
                        long rowCount)
Check for a slow query and update cache accordingly.


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()