|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.jdbc.kernel.PreparedQueryCacheImpl
public class PreparedQueryCacheImpl
An implementation of the cache of prepared queries.
| Nested Class Summary | |
|---|---|
static class |
PreparedQueryCacheImpl.StrongExclusion
Strong exclusion. |
static class |
PreparedQueryCacheImpl.WeakExclusion
Weak exclusion. |
| Nested classes/interfaces inherited from interface org.apache.openjpa.kernel.PreparedQueryCache |
|---|
PreparedQueryCache.Exclusion |
| Constructor Summary | |
|---|---|
PreparedQueryCacheImpl()
|
|
| Method Summary | |
|---|---|
void |
addExclusionPattern(String pattern)
Adds a pattern for exclusion. |
boolean |
cache(PreparedQuery q)
Cache the given query keyed by its identifier. |
void |
clear()
Clears all cached queries. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
PreparedQuery |
get(String id)
Get the PreparedQuery with the given identifier if it exists. |
boolean |
getEnableStatistics()
Affirm if statistics is gathered. |
List<PreparedQueryCache.Exclusion> |
getExcludes()
Gets the exclusion patterns. |
Map<String,String> |
getMapView()
Get a map view of the cached queries indexed by identifier. |
QueryStatistics<String> |
getStatistics()
Gets the simple statistics for executed queries. |
PreparedQuery |
initialize(String key,
Object result)
Initialize the cached Prepared Query registered with the given key earlier by the given execution result. |
boolean |
invalidate(String id)
Remove the PreparedQuery with the given identifier from this cache. |
Boolean |
isCachable(String id)
Affirms if a PreparedQuery can be cached against the given key. |
PreparedQueryCache.Exclusion |
isExcluded(String id)
Returns the exclusion status of if the given query key. |
(package private) boolean |
isHinted(FetchConfiguration fetch,
String hint)
|
protected void |
lock(boolean readOnly)
Note: Care needs to be taken so that a read lock is never held while requesting a write lock. |
PreparedQuery |
markUncachable(String id,
PreparedQueryCache.Exclusion exclusion)
Marks the given key as not amenable to caching. |
(package private) boolean |
matches(String pattern,
String target)
|
Boolean |
register(String id,
Query query,
FetchConfiguration hints)
Register the given query for caching against the given key if it has not already been cached. |
void |
removeExclusionPattern(String pattern)
Removes a pattern for exclusion. |
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties. |
void |
setEnableStatistics(boolean enable)
Enable/disable gathering of statistics. |
void |
setExcludes(String excludes)
Sets one or more exclusion regular expression patterns separated by semicolon. |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
protected void |
unlock(boolean readOnly)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PreparedQueryCacheImpl()
| Method Detail |
|---|
public Boolean register(String id,
Query query,
FetchConfiguration hints)
PreparedQueryCache
register in interface PreparedQueryCachepublic Map<String,String> getMapView()
PreparedQueryCache
getMapView in interface PreparedQueryCachepublic boolean cache(PreparedQuery q)
cache in interface PreparedQueryCache#markUncachable(String),
PreparedQueryCache.setExcludes(String),
PreparedQueryCache.addExclusionPattern(String)
public PreparedQuery initialize(String key,
Object result)
PreparedQueryCache
initialize in interface PreparedQueryCachekey - the key used during registrationresult - an opaque instance carrying the execution result
of the original query.
public boolean invalidate(String id)
PreparedQueryCache
invalidate in interface PreparedQueryCachepublic PreparedQuery get(String id)
PreparedQueryCache
get in interface PreparedQueryCachepublic Boolean isCachable(String id)
PreparedQueryCache
isCachable in interface PreparedQueryCache
public PreparedQuery markUncachable(String id,
PreparedQueryCache.Exclusion exclusion)
PreparedQueryCache
markUncachable in interface PreparedQueryCacheid - is the key to be excludedexclusion - directs whether exclusion is irreversible or not.
public PreparedQueryCache.Exclusion isExcluded(String id)
PreparedQueryCache
isExcluded in interface PreparedQueryCachepublic void setExcludes(String excludes)
PreparedQueryCache
setExcludes in interface PreparedQueryCachepublic List<PreparedQueryCache.Exclusion> getExcludes()
PreparedQueryCache
getExcludes in interface PreparedQueryCachepublic void addExclusionPattern(String pattern)
addExclusionPattern in interface PreparedQueryCachepublic void removeExclusionPattern(String pattern)
removeExclusionPattern in interface PreparedQueryCachePreparedQueryCache.markUncachable(String, Exclusion)public QueryStatistics<String> getStatistics()
PreparedQueryCache
getStatistics in interface PreparedQueryCacheprotected void lock(boolean readOnly)
readOnly - - If true, a read lock will be acquired. Else a write lock will be acquired.protected void unlock(boolean readOnly)
readOnly - - If true, the read lock will be released. Else a write lock will be released.
boolean matches(String pattern,
String target)
boolean isHinted(FetchConfiguration fetch,
String hint)
public void clear()
PreparedQueryCache
clear in interface PreparedQueryCachepublic void setEnableStatistics(boolean enable)
PreparedQueryCache
setEnableStatistics in interface PreparedQueryCachepublic boolean getEnableStatistics()
PreparedQueryCache
getEnableStatistics in interface PreparedQueryCachepublic void setConfiguration(Configuration conf)
Configurable
setConfiguration in interface Configurablepublic void startConfiguration()
Configurable
startConfiguration in interface Configurablepublic void endConfiguration()
Configurable
endConfiguration in interface Configurable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||