| 
 | ||||||||||
| 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.AbstractDataCache
org.apache.openjpa.datacache.ConcurrentDataCache
public class ConcurrentDataCache
A DataCache implementation that is optimized for concurrent
 access. When the cache fills up, values to remove from cache are chosen
 randomly. Due to race conditions, it is possible that a get call might not
 return a cached instance if that instance is being transferred between
 internal datastructures.
| Field Summary | 
|---|
| Fields inherited from class org.apache.openjpa.datacache.AbstractDataCache | 
|---|
| conf, log | 
| Fields inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager | 
|---|
| _listeners | 
| Fields inherited from interface org.apache.openjpa.datacache.DataCache | 
|---|
| NAME_DEFAULT | 
| Constructor Summary | |
|---|---|
| ConcurrentDataCache() | |
| Method Summary | |
|---|---|
| protected  void | clearInternal()Clear the cache. | 
|  CacheMap | getCacheMap()Returns the underlying CacheMapthat this cache is using. | 
|  int | getCacheSize()Returns the maximum number of unpinned objects to keep hard references to. | 
| protected  DataCachePCData | getInternal(java.lang.Object key)Return the object for the given oid. | 
|  int | getSoftReferenceSize()Returns the maximum number of unpinned objects to keep soft references to. | 
|  void | initialize(DataCacheManager mgr)Initialize any resources associated with the given DataCacheManager. | 
| protected  CacheMap | newCacheMap()Return the map to use as an internal cache; entry expirations must invoke AbstractDataCache.keyRemoved(java.lang.Object, boolean). | 
| protected  boolean | pinInternal(java.lang.Object key)Pin an object to the cache. | 
| protected  DataCachePCData | putInternal(java.lang.Object key,
            DataCachePCData pc)Add the given object to the cache, returning the old object under the given oid. | 
| protected  void | removeAllInternal(java.lang.Class cls,
                  boolean subs)Evict objects in cache by class. | 
| protected  DataCachePCData | removeInternal(java.lang.Object key)Remove the object under the given oid from the cache. | 
|  void | setCacheSize(int size)Sets the maximum number of unpinned objects to keep hard references to. | 
|  void | setSoftReferenceSize(int size)Sets the maximum number of unpinned objects to keep soft references to. | 
|  void | unpinAll(java.lang.Class cls,
         boolean subs)Unpin all oids associaed with the given type from the cache. | 
| protected  boolean | unpinInternal(java.lang.Object key)Unpin an object from the cache. | 
|  void | writeLock()Obtain a write lock on the cache. | 
|  void | writeUnlock()Release the write lock on the cache. | 
| Methods inherited from class org.apache.openjpa.datacache.AbstractDataCache | 
|---|
| addExpirationListener, afterCommit, clear, close, close, commit, contains, containsAll, endConfiguration, fireEvent, get, getAll, getEvictionSchedule, getName, isClosed, keyRemoved, pin, pinAll, pinAll, put, putAllInternal, recacheUpdates, remove, removeAll, removeAll, removeAllInternal, removeAllTypeNamesInternal, removeExpirationListener, setConfiguration, setEvictionSchedule, setName, startConfiguration, toString, unpin, unpinAll, update | 
| Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager | 
|---|
| addListener, fireEvent, getListeners, hasListener, hasListeners, isFailFast, newListenerCollection, removeListener, setFailFast | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface org.apache.openjpa.event.RemoteCommitListener | 
|---|
| afterCommit, close | 
| Constructor Detail | 
|---|
public ConcurrentDataCache()
| Method Detail | 
|---|
public CacheMap getCacheMap()
CacheMap that this cache is using.
 This is not an unmodifiable view on the map, so care should be taken
 with this reference. Implementations should probably not modify the
 contents of the cache, but should only use this reference to
 obtain cache metrics.
public void setCacheSize(int size)
size, then this method will result in the cache
 flushing old values.
public int getCacheSize()
public void setSoftReferenceSize(int size)
size, then this method will result in the cache
 flushing values.
public int getSoftReferenceSize()
-1.
public void initialize(DataCacheManager mgr)
DataCacheDataCacheManager.
initialize in interface DataCacheinitialize in class AbstractDataCache
public void unpinAll(java.lang.Class cls,
                     boolean subs)
DataCache
unpinAll in interface DataCacheunpinAll in class AbstractDataCachesubs - Whether to include subclasses.public void writeLock()
DataCache
writeLock in interface DataCachepublic void writeUnlock()
DataCache
writeUnlock in interface DataCacheprotected CacheMap newCacheMap()
AbstractDataCache.keyRemoved(java.lang.Object, boolean).
protected DataCachePCData getInternal(java.lang.Object key)
AbstractDataCache
getInternal in class AbstractDataCache
protected DataCachePCData putInternal(java.lang.Object key,
                                      DataCachePCData pc)
AbstractDataCache
putInternal in class AbstractDataCacheprotected DataCachePCData removeInternal(java.lang.Object key)
AbstractDataCache
removeInternal in class AbstractDataCache
protected void removeAllInternal(java.lang.Class cls,
                                 boolean subs)
AbstractDataCache
removeAllInternal in class AbstractDataCacheprotected void clearInternal()
AbstractDataCache
clearInternal in class AbstractDataCacheprotected boolean pinInternal(java.lang.Object key)
AbstractDataCache
pinInternal in class AbstractDataCacheprotected boolean unpinInternal(java.lang.Object key)
AbstractDataCache
unpinInternal in class AbstractDataCache| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||