|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.cache.AbstractRequestCache
This class defines the minimal functionnalities that a request cache must provide.
Only read requests (SELECT
s) can be cached, there is no
sense to cache writes as they do not provide any result to cache. However,
the cache must be notified of the write queries in order to maintain cache
coherency.
Field Summary | |
(package private) static Trace |
logger
Logger instance. |
protected int |
parsingGranularity
Parsing granularity. |
protected long |
pendingQueryTimeout
Pending query timeout. |
Constructor Summary | |
AbstractRequestCache()
|
Method Summary | |
abstract void |
addToCache(SelectRequest request,
java.sql.ResultSet result)
Adds an entry request/reply to the cache. |
abstract void |
commit(TransactionMarkerMetaData tm)
Commit a transaction given its id. |
abstract void |
flushCache()
Removes all entries from the cache. |
abstract QueryCacheEntry |
getFromCache(SelectRequest request,
boolean addToPendingQueries)
Gets the result to the given request from the cache. |
abstract java.lang.String |
getInformation()
Gets information about the request cache. |
int |
getParsingGranularity()
Gets the needed query parsing granularity. |
int |
getPendingQueryTimeout()
Returns the pending query timeout. |
abstract java.lang.String |
getXmlInformation()
Gets information about the request cache in xml |
void |
mergeDatabaseSchema(DatabaseSchema dbs)
Merge the given DatabaseSchema with the current one. |
abstract void |
removeFromCache(SelectRequest request)
Removes an entry from the cache (both request and reply are dropped). |
abstract void |
rollback(TransactionMarkerMetaData tm)
Rollback a transaction given its id. |
void |
setDatabaseSchema(DatabaseSchema dbs)
Sets the DatabaseSchema of the current virtual database. |
void |
setParsingGranularity(int parsingGranularity)
Sets the needed query parsing granularity. |
void |
setPendingQueryTimeout(int pendingQueryTimeout)
Sets the pending query timeout. |
abstract void |
writeNotify(AbstractWriteRequest request)
Notifies the cache that the given write request has been issued, so that cache coherency can be maintained. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int parsingGranularity
ParsingGranularities.NO_PARSING
.
protected long pendingQueryTimeout
static Trace logger
Constructor Detail |
public AbstractRequestCache()
Method Detail |
public int getParsingGranularity()
setParsingGranularity(int)
public void setParsingGranularity(int parsingGranularity)
parsingGranularity
- the query parsing granularity to setgetParsingGranularity()
public int getPendingQueryTimeout()
setPendingQueryTimeout(int)
public void setPendingQueryTimeout(int pendingQueryTimeout)
pendingQueryTimeout
- the pending query timeout to set.getPendingQueryTimeout()
public void setDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema
of the current virtual database.
dbs
- a DatabaseSchema
valueCacheDatabaseSchema
public void mergeDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema
with the current one.
dbs
- a DatabaseSchema
valueCacheDatabaseSchema
public abstract void addToCache(SelectRequest request, java.sql.ResultSet result) throws CacheException
request
- the requestresult
- the result corresponding to the request
CacheException
- if an error occurspublic abstract QueryCacheEntry getFromCache(SelectRequest request, boolean addToPendingQueries)
The returned QueryCacheEntry
is null
if the
request is not present in the cache.
An invalid QueryCacheEntry
may be returned (it means that
the result is null
) but the already parsed query can be
retrieved from the cache entry.
request
- an SQL select requestaddToPendingQueries
- true if the request must be added to the
pending query list on a cache miss
QueryCacheEntry
if found, else nullpublic abstract void removeFromCache(SelectRequest request) throws CacheException
request
- a SelectRequest
CacheException
- if an error occurspublic abstract void writeNotify(AbstractWriteRequest request) throws CacheException
request
- an AbstractWriteRequest
value
CacheException
- if an error occurspublic abstract void flushCache()
public abstract void commit(TransactionMarkerMetaData tm) throws CacheException
tm
- the transaction marker metadata
CacheException
- if an error occurspublic abstract void rollback(TransactionMarkerMetaData tm) throws CacheException
tm
- the transaction marker metadata
CacheException
- if an error occurspublic abstract java.lang.String getInformation()
String
containing informationpublic abstract java.lang.String getXmlInformation()
String
containing information
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |