org.objectweb.cjdbc.controller.cache.parsing
Class ParsingCache

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.cache.parsing.ParsingCache

public class ParsingCache
extends java.lang.Object

This class implements a request parsing cache.

Version:
1.0
Author:
Emmanuel Cecchet

Nested Class Summary
private  class ParsingCache.CurrentlyParsingEntry
          CurrentlyParsingEntry contains a (Request,ParserThread) which is an element of the currentlyParsing Hashtable.
 
Field Summary
private  boolean backgroundParsing
           
private  java.util.Hashtable cache
           
private  boolean caseSensitiveParsing
           
private  java.util.Hashtable currentlyParsing
           
private  int granularity
           
private static Trace logger
           
private  int maxNbOfEntries
           
private  RequestManager requestManager
           
 
Constructor Summary
ParsingCache(int size, boolean backgroundParsing)
          Constructor for ParsingCache.
 
Method Summary
 int getGranularity()
          Returns the granularity value.
 void getParsingFromCache(AbstractRequest request)
          If the same SQL query is found in the cache, the parsing is cloned into the given request.
 void getParsingFromCacheAndParseIfMissing(AbstractRequest request)
          Method getParsingFromCacheAndParseIfMissing.
 RequestManager getRequestManager()
          Returns the requestManager value.
 java.lang.String getXml()
          Get xml information about this ParsingCache
 boolean isBackgroundParsing()
          Returns the backgroundParsing.
 boolean isCaseSensitiveParsing()
          Returns the caseSensitiveParsin.
 void setBackgroundParsing(boolean backgroundParsing)
          Sets the background parsing.
 void setCaseSensitiveParsing(boolean isCaseSensitiveParsing)
          Sets the parsing case sensitivity
 void setGranularity(int granularity)
          Sets the granularity value.
 void setRequestManager(RequestManager requestManager)
          Sets the requestManager value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static Trace logger

cache

private java.util.Hashtable cache

currentlyParsing

private java.util.Hashtable currentlyParsing

requestManager

private RequestManager requestManager

granularity

private int granularity

maxNbOfEntries

private int maxNbOfEntries

backgroundParsing

private boolean backgroundParsing

caseSensitiveParsing

private boolean caseSensitiveParsing
Constructor Detail

ParsingCache

public ParsingCache(int size,
                    boolean backgroundParsing)
Constructor for ParsingCache.

Parameters:
size - maximum cache size in nb of entries
backgroundParsing - true if the parsing should be done in background by a ParserThread
Method Detail

getGranularity

public int getGranularity()
Returns the granularity value.

Returns:
Returns the granularity.

setGranularity

public void setGranularity(int granularity)
Sets the granularity value.

Parameters:
granularity - The granularity to set.

getRequestManager

public RequestManager getRequestManager()
Returns the requestManager value.

Returns:
Returns the requestManager.

setRequestManager

public void setRequestManager(RequestManager requestManager)
Sets the requestManager value.

Parameters:
requestManager - The requestManager to set.

getParsingFromCache

public void getParsingFromCache(AbstractRequest request)
If the same SQL query is found in the cache, the parsing is cloned into the given request. If backgroundParsing is set to true, then a ParserThread starts parsing the request in background else nothing is done on a cache miss.

Parameters:
request - the request you look for

getParsingFromCacheAndParseIfMissing

public void getParsingFromCacheAndParseIfMissing(AbstractRequest request)
                                          throws java.sql.SQLException
Method getParsingFromCacheAndParseIfMissing.

Parameters:
request - the request we look for
Throws:
java.sql.SQLException - if an error occurs

isBackgroundParsing

public boolean isBackgroundParsing()
Returns the backgroundParsing.

Returns:
boolean

setBackgroundParsing

public void setBackgroundParsing(boolean backgroundParsing)
Sets the background parsing. If true the request are parsed in background by a separate thread that is created for this purpose.

Parameters:
backgroundParsing - The backgroundParsing to set

setCaseSensitiveParsing

public void setCaseSensitiveParsing(boolean isCaseSensitiveParsing)
Sets the parsing case sensitivity

Parameters:
isCaseSensitiveParsing - true if parsing is case sensitive

isCaseSensitiveParsing

public boolean isCaseSensitiveParsing()
Returns the caseSensitiveParsin.

Returns:
boolean

getXml

public java.lang.String getXml()
Get xml information about this ParsingCache

Returns:
String in xml formatted text


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.