|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
org.apache.openjpa.datacache.AbstractQueryCache
public abstract class AbstractQueryCache
Abstract QueryCache
implementation that provides various
statistics, logging, and timeout functionality common across cache
implementations.
Field Summary | |
---|---|
protected OpenJPAConfiguration |
conf
The configuration set by the system. |
protected org.apache.openjpa.lib.log.Log |
log
The log to use. |
Constructor Summary | |
---|---|
AbstractQueryCache()
|
Method Summary | |
---|---|
void |
addTypesChangedListener(TypesChangedListener listen)
Add a new types event listener to this cache. |
void |
afterCommit(RemoteCommitEvent event)
This method is part of the RemoteCommitListener interface. |
void |
clear()
Remove all data from this cache. |
protected abstract void |
clearInternal()
Clear the cache. |
void |
close()
Free the resources used by this cache. |
protected void |
close(boolean clear)
|
void |
endConfiguration()
|
protected void |
fireEvent(java.lang.Object event,
java.lang.Object listener)
|
QueryResult |
get(QueryKey key)
Return a list of oids for the given query key. |
protected abstract QueryResult |
getInternal(QueryKey qk)
Return the list for the given key. |
void |
initialize(DataCacheManager manager)
Initialize any resources associated with the given DataCacheManager . |
boolean |
isClosed()
|
protected abstract java.util.Collection |
keySet()
Return a threadsafe view of the keys in this cache. |
protected java.util.Collection |
newListenerCollection()
Individual query results will be registered as types changed listeners. |
void |
onTypesChanged(TypesChangedEvent ev)
Notification that instances of persistent types have changed. |
boolean |
pin(QueryKey key)
Pin the value stored under qk into the
cache. |
protected abstract boolean |
pinInternal(QueryKey qk)
Pin an object to the cache. |
QueryResult |
put(QueryKey qk,
QueryResult oids)
Set the list of OIDs for the given query key. |
protected abstract QueryResult |
putInternal(QueryKey qk,
QueryResult oids)
Add the given result to the cache, returning the old result under the given key. |
QueryResult |
remove(QueryKey key)
Remove the value stored under the given query key. |
protected void |
removeAllInternal(java.util.Collection qks)
Remove all results under the given keys from the cache. |
protected abstract QueryResult |
removeInternal(QueryKey qk)
Remove the result under the given key from the cache. |
boolean |
removeTypesChangedListener(TypesChangedListener listen)
Remove an types event listener from this cache. |
void |
setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
|
void |
startConfiguration()
|
boolean |
unpin(QueryKey key)
Unpin the value stored under key into the cache. |
protected abstract boolean |
unpinInternal(QueryKey qk)
Unpin an object from the cache. |
Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager |
---|
addListener, fireEvent, getListeners, hasListener, hasListeners, removeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.openjpa.datacache.QueryCache |
---|
writeLock, writeUnlock |
Field Detail |
---|
protected OpenJPAConfiguration conf
protected org.apache.openjpa.lib.log.Log log
Constructor Detail |
---|
public AbstractQueryCache()
Method Detail |
---|
public void initialize(DataCacheManager manager)
QueryCache
DataCacheManager
.
initialize
in interface QueryCache
public void onTypesChanged(TypesChangedEvent ev)
TypesChangedListener
onTypesChanged
in interface TypesChangedListener
public QueryResult get(QueryKey key)
QueryCache
get
in interface QueryCache
public QueryResult put(QueryKey qk, QueryResult oids)
QueryCache
put
in interface QueryCache
null
if
the key was not previously cached. See Map.put(K, V)
for more information.public QueryResult remove(QueryKey key)
QueryCache
QueryCache
class. Instead, the cache should
be updated by implementing RemoteCommitListener
,
which will result in all queries that may be invalid being dropped.
remove
in interface QueryCache
null
if
the key was not previously cached. See Map.remove(java.lang.Object)
for more information.public boolean pin(QueryKey key)
QueryCache
qk
into the
cache. This method guarantees that qk
's value
will not be expired if the cache exceeds its capacity. It
causes this data to be ignored when determining whether or not
the cache is full, effectively increasing the total amount of
data stored in the cache. This method does not affect the
behavior of QueryCache.remove(org.apache.openjpa.datacache.QueryKey)
or TypesChangedListener.onTypesChanged(org.apache.openjpa.datacache.TypesChangedEvent)
.
pin
in interface QueryCache
true
if key
's value was
pinned into the cache; false
if the key is not in the cache.public boolean unpin(QueryKey key)
QueryCache
key
into the cache.
This method reverses a previous invocation of QueryCache.pin(org.apache.openjpa.datacache.QueryKey)
.
This method does not remove anything from the cache; it merely
makes key
's value a candidate for flushing from the cache.
unpin
in interface QueryCache
true
if key
's value was
unpinned from the cache; false
if the
key is not in the cache.public void clear()
QueryCache
clear
in interface QueryCache
public void close()
QueryCache
close
in interface QueryCache
close
in interface org.apache.openjpa.lib.util.Closeable
protected void close(boolean clear)
public boolean isClosed()
public void addTypesChangedListener(TypesChangedListener listen)
QueryCache
addTypesChangedListener
in interface QueryCache
public boolean removeTypesChangedListener(TypesChangedListener listen)
QueryCache
removeTypesChangedListener
in interface QueryCache
public void afterCommit(RemoteCommitEvent event)
RemoteCommitListener
interface. If
your cache subclass relies on OpenJPA for clustering support, make it
implement RemoteCommitListener
. This method will take
care of invalidating entries from remote commits, by delegating to
onTypesChanged(org.apache.openjpa.datacache.TypesChangedEvent)
.
protected abstract java.util.Collection keySet()
protected abstract QueryResult getInternal(QueryKey qk)
protected abstract QueryResult putInternal(QueryKey qk, QueryResult oids)
protected abstract QueryResult removeInternal(QueryKey qk)
protected void removeAllInternal(java.util.Collection qks)
protected abstract void clearInternal()
protected abstract boolean pinInternal(QueryKey qk)
protected abstract boolean unpinInternal(QueryKey qk)
public void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
setConfiguration
in interface org.apache.openjpa.lib.conf.Configurable
public void startConfiguration()
startConfiguration
in interface org.apache.openjpa.lib.conf.Configurable
public void endConfiguration()
endConfiguration
in interface org.apache.openjpa.lib.conf.Configurable
protected void fireEvent(java.lang.Object event, java.lang.Object listener)
fireEvent
in class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
protected java.util.Collection newListenerCollection()
newListenerCollection
in class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |