|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 PreparedQueryCache
public Map<String,String> getMapView()
PreparedQueryCache
getMapView
in interface PreparedQueryCache
public 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 PreparedQueryCache
key
- 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 PreparedQueryCache
public PreparedQuery get(String id)
PreparedQueryCache
get
in interface PreparedQueryCache
public Boolean isCachable(String id)
PreparedQueryCache
isCachable
in interface PreparedQueryCache
public PreparedQuery markUncachable(String id, PreparedQueryCache.Exclusion exclusion)
PreparedQueryCache
markUncachable
in interface PreparedQueryCache
id
- is the key to be excludedexclusion
- directs whether exclusion is irreversible or not.
public PreparedQueryCache.Exclusion isExcluded(String id)
PreparedQueryCache
isExcluded
in interface PreparedQueryCache
public void setExcludes(String excludes)
PreparedQueryCache
setExcludes
in interface PreparedQueryCache
public List<PreparedQueryCache.Exclusion> getExcludes()
PreparedQueryCache
getExcludes
in interface PreparedQueryCache
public void addExclusionPattern(String pattern)
addExclusionPattern
in interface PreparedQueryCache
public void removeExclusionPattern(String pattern)
removeExclusionPattern
in interface PreparedQueryCache
PreparedQueryCache.markUncachable(String, Exclusion)
public QueryStatistics<String> getStatistics()
PreparedQueryCache
getStatistics
in interface PreparedQueryCache
protected 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 PreparedQueryCache
public void setEnableStatistics(boolean enable)
PreparedQueryCache
setEnableStatistics
in interface PreparedQueryCache
public boolean getEnableStatistics()
PreparedQueryCache
getEnableStatistics
in interface PreparedQueryCache
public void setConfiguration(Configuration conf)
Configurable
setConfiguration
in interface Configurable
public void startConfiguration()
Configurable
startConfiguration
in interface Configurable
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |