SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.runtime.datacache.plugins
Class CacheImpl

java.lang.Object
  |
  +--com.solarmetric.kodo.runtime.datacache.AbstractCacheImpl
        |
        +--com.solarmetric.kodo.runtime.datacache.plugins.CacheImpl
All Implemented Interfaces:
Configurable, DataCache, RemoteCommitListener

public class CacheImpl
extends AbstractCacheImpl
implements RemoteCommitListener

A PersistenceManagerFactory cache implementation. Batch updates are performed atomically.


Fields inherited from class com.solarmetric.kodo.runtime.datacache.AbstractCacheImpl
cache, s_log
 
Constructor Summary
CacheImpl()
           
 
Method Summary
protected  boolean addExistingUpdates()
          Do nothing with the existing updates.
 void close()
          Close any resources used by this listener.
 void endConfiguration()
          Invoked upon completion of configuration of this object
 CacheMap getCacheMap()
          Deprecated. Use AbstractCacheImpl.getMap() instead.
 int getCacheSize()
          Returns the maximum number of unpinned objects to keep hard references to.
 boolean getKeepSoftReferences()
          Returns whether or not this cache will keep soft references when objects expire.
 int getSoftReferenceSize()
          Returns the maximum number of unpinned objects to keep soft references to.
protected  Map newMap()
          Returns a new CacheMap for use as the underlying data cache.
 boolean pin(Object key)
          Pin the value stored under key into the cache.
 void setCacheSize(int size)
          Sets the maximum number of unpinned objects to keep hard references to.
 void setKeepSoftReferences(boolean refs)
          Configures whether or not this cache will keep soft references when objects expire.
 void setSoftReferenceSize(int size)
          Sets the maximum number of unpinned objects to keep soft references to.
 void startConfiguration()
          Invoked before configuration is begun on this object
 void transactionCommitted(Set added, Set updated, Set deleted)
          Notification that a transaction associated with a different PersistenceManagerFactory has successfully committed.
 boolean unpin(Object key)
          Unpin the value stored under key into the cache.
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.AbstractCacheImpl
addExpirationListener, batchUpdate, clear, containsKey, get, getCacheStatisticsString, getHitCount, getMap, getMissCount, getName, getRecordCacheStatistics, isDecorator, keyExpired, put, remove, removeAll, removeDecorator, removeDecorators, removeExpirationListener, setName, setRecordCacheStatistics, toString, updateValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheImpl

public CacheImpl()
Method Detail

getCacheMap

public CacheMap getCacheMap()
Deprecated. Use AbstractCacheImpl.getMap() instead.

Returns the underlying CacheMap that this CacheImpl is using. This is not an unmodifiable view on the map, so care should be taken with this reference. Implementations should probably not mess with the contents of the cache, but should only use this reference to obtain cache metrics.


setCacheSize

public void setCacheSize(int size)
Sets the maximum number of unpinned objects to keep hard references to. If the map contains more unpinned objects than size, then this method will result in the cache flushing old values.

getCacheSize

public int getCacheSize()
Returns the maximum number of unpinned objects to keep hard references to.

setSoftReferenceSize

public void setSoftReferenceSize(int size)
Sets the maximum number of unpinned objects to keep soft references to. If the map contains more soft references than size, then this method will result in the cache flushing values.

getSoftReferenceSize

public int getSoftReferenceSize()
Returns the maximum number of unpinned objects to keep soft references to. Defaults to -1.

setKeepSoftReferences

public void setKeepSoftReferences(boolean refs)
Configures whether or not this cache will keep soft references when objects expire. Defaults to true.

getKeepSoftReferences

public boolean getKeepSoftReferences()
Returns whether or not this cache will keep soft references when objects expire.

newMap

protected Map newMap()
Returns a new CacheMap for use as the underlying data cache. This implementation returns a CacheMap. To implement a more sophisticated caching strategy, override this method to return a subclass of CacheMap.
Overrides:
newMap in class AbstractCacheImpl

addExistingUpdates

protected boolean addExistingUpdates()
Do nothing with the existing updates. This relies on the fact that any existing PCDatas are objects retrieved by invoking get() on this object in an atomic (synchronized) fashion.
Overrides:
addExistingUpdates in class AbstractCacheImpl

pin

public boolean pin(Object key)
Description copied from interface: DataCache
Pin the value stored under key into the cache. This method guarantees that key's value will not be dropped by the caching algorithm. This method does not affect the behavior of DataCache.remove(java.lang.Object).
Following copied from interface: com.solarmetric.kodo.runtime.datacache.DataCache
Returns:
true if key's value was pinned into the cache; false if the key is not in the cache.

unpin

public boolean unpin(Object key)
Description copied from interface: DataCache
Unpin the value stored under key into the cache. This method reverses a previous invocation of DataCache.pin(java.lang.Object). This method does not remove anything from the cache; it merely makes key's value a candidate for flushing from the cache.
Following copied from interface: com.solarmetric.kodo.runtime.datacache.DataCache
Returns:
true if key's value was unpinned from the cache; false if the key is not in the cache.

close

public void close()
Description copied from interface: RemoteCommitListener
Close any resources used by this listener.
Specified by:
close in interface RemoteCommitListener
Overrides:
close in class AbstractCacheImpl

startConfiguration

public void startConfiguration()
Description copied from interface: Configurable
Invoked before configuration is begun on this object
Overrides:
startConfiguration in class AbstractCacheImpl

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of configuration of this object
Overrides:
endConfiguration in class AbstractCacheImpl

transactionCommitted

public void transactionCommitted(Set added,
                                 Set updated,
                                 Set deleted)
Description copied from interface: RemoteCommitListener

Notification that a transaction associated with a different PersistenceManagerFactory has successfully committed. added, updated, and deleted are sets of object IDs that were added, updated, or deleted, respectively.

Specified by:
transactionCommitted in interface RemoteCommitListener

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.