org.objectweb.cjdbc.controller.requestmanager
Class ParsingCache

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.requestmanager.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  RequestManager requestManager
           
 
Constructor Summary
ParsingCache(int granularity, RequestManager requestManager)
          Constructor for ParsingCache.
ParsingCache(int granularity, RequestManager requestManager, boolean backgroundParsing)
          Constructor for ParsingCache.
 
Method Summary
 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.
 boolean isBackgroundParsing()
          Returns the backgroundParsing.
 boolean isCaseSensitiveParsing()
          Returns the caseSensitiveParsin.
 void setBackgroundParsing(boolean backgroundParsing)
          Sets the backgroundParsing.
 void setCaseSensitiveParsing(boolean isCaseSensitiveParsing)
          Sets the parsing case sensitivity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private java.util.Hashtable cache

currentlyParsing

private java.util.Hashtable currentlyParsing

requestManager

private RequestManager requestManager

granularity

private int granularity

backgroundParsing

private boolean backgroundParsing

caseSensitiveParsing

private boolean caseSensitiveParsing
Constructor Detail

ParsingCache

public ParsingCache(int granularity,
                    RequestManager requestManager)
Constructor for ParsingCache.

Parameters:
granularity - the parsing granularity
requestManager - the request manager this cache belongs to

ParsingCache

public ParsingCache(int granularity,
                    RequestManager requestManager,
                    boolean backgroundParsing)
Constructor for ParsingCache.

Parameters:
granularity - the parsing granularity
requestManager - the request manager this cache belongs to
backgroundParsing - true if the parsing should be done in background by a ParserThread
Method Detail

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 backgroundParsing.

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


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