Kodo 4.1.0 generated on October 9 2006

kodo.datacache
Class TangosolDataCache

java.lang.Object
  extended by org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
      extended by org.apache.openjpa.datacache.AbstractDataCache
          extended by kodo.datacache.TangosolDataCache
All Implemented Interfaces:
org.apache.openjpa.datacache.DataCache, org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.util.Closeable, org.apache.openjpa.lib.util.EventManager

public class TangosolDataCache
extends org.apache.openjpa.datacache.AbstractDataCache

A level 2 cache that delegates to a Tangosol Coherence cache. This cache can be used to share data among Brokers created from a single BrokerFactory. Batch updates are performed atomically.


Field Summary
static int TYPE_DISTRIBUTED
           
static int TYPE_NAMED
           
static int TYPE_REPLICATED
           
 
Fields inherited from class org.apache.openjpa.datacache.AbstractDataCache
conf, log
 
Fields inherited from interface org.apache.openjpa.datacache.DataCache
NAME_DEFAULT
 
Constructor Summary
TangosolDataCache()
           
 
Method Summary
 void addExpirationListener(org.apache.openjpa.datacache.ExpirationListener listen)
           
protected  void clearInternal()
           
 void close()
           
 void endConfiguration()
           
 boolean getClearOnClose()
          Whether the contents of the named cache will be cleared when this facade is closed.
protected  org.apache.openjpa.datacache.DataCachePCData getInternal(Object key)
           
 com.tangosol.net.NamedCache getTangosolCache()
          Returns the underlying NamedCache that this TangosolDataCache is using.
 String getTangosolCacheName()
          Returns the name of the Tangosol cache to use.
 int getTangosolCacheType()
          The tangosol cache type as one of the TYPE constants.
protected  com.tangosol.net.NamedCache newTangosolCache(String name)
          Returns a new NamedCache for use as the underlying data cache.
protected  boolean pinInternal(Object key)
          Coherence doesn't have a concept of expiring data, so pinning is meaningless.
protected  org.apache.openjpa.datacache.DataCachePCData putInternal(Object key, org.apache.openjpa.datacache.DataCachePCData pc)
           
protected  boolean recacheUpdates()
          Tangosol does not automatically update objects stored in the cache, so we must re-enlist them as appropriate.
protected  void removeAllInternal(Class cls, boolean subclasses)
           
protected  org.apache.openjpa.datacache.DataCachePCData removeInternal(Object key)
           
 void setClearOnClose(boolean clearOnClose)
          Sets the option to clear the Tangosol cache when this facade is closed.
 void setTangosolCacheName(String name)
          Sets the name of the Tangosol cache to use.
 void setTangosolCacheType(int type)
          The tangosol cache type as one of the TYPE constants.
 void setTangosolCacheType(String type)
          If distributed, this cache implementation will use a distibuted cache.
protected  boolean unpinInternal(Object key)
          Coherence doesn't have a concept of expiring data, so unpinning is meaningless.
 void writeLock()
           
 void writeUnlock()
           
 
Methods inherited from class org.apache.openjpa.datacache.AbstractDataCache
afterCommit, clear, close, commit, contains, containsAll, fireEvent, get, getEvictionSchedule, getName, initialize, isClosed, keyRemoved, pin, pinAll, pinAll, put, putAllInternal, remove, removeAll, removeAll, removeAllInternal, removeAllTypeNamesInternal, removeExpirationListener, setConfiguration, setEvictionSchedule, setName, startConfiguration, toString, unpin, unpinAll, 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
 

Field Detail

TYPE_DISTRIBUTED

public static final int TYPE_DISTRIBUTED
See Also:
Constant Field Values

TYPE_REPLICATED

public static final int TYPE_REPLICATED
See Also:
Constant Field Values

TYPE_NAMED

public static final int TYPE_NAMED
See Also:
Constant Field Values
Constructor Detail

TangosolDataCache

public TangosolDataCache()
Method Detail

getTangosolCache

public com.tangosol.net.NamedCache getTangosolCache()
Returns the underlying NamedCache that this TangosolDataCache 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.


setTangosolCacheName

public void setTangosolCacheName(String name)
Sets the name of the Tangosol cache to use.


getTangosolCacheName

public final String getTangosolCacheName()
Returns the name of the Tangosol cache to use.


setTangosolCacheType

public void setTangosolCacheType(int type)
The tangosol cache type as one of the TYPE constants.


getTangosolCacheType

public int getTangosolCacheType()
The tangosol cache type as one of the TYPE constants.


setTangosolCacheType

public void setTangosolCacheType(String type)
If distributed, this cache implementation will use a distibuted cache. If replicated, this cache implementation will use a replicated cache. If left unset or set to named, the cache is looked up through Coherence's named-cache lookup mechanisms. This method is primarily used for automated string-based configuration.


setClearOnClose

public void setClearOnClose(boolean clearOnClose)
Sets the option to clear the Tangosol cache when this facade is closed. When this option is true, all contents of the named cache will be cleared. Defaults to false.


getClearOnClose

public boolean getClearOnClose()
Whether the contents of the named cache will be cleared when this facade is closed.


writeLock

public void writeLock()

writeUnlock

public void writeUnlock()

addExpirationListener

public void addExpirationListener(org.apache.openjpa.datacache.ExpirationListener listen)
Specified by:
addExpirationListener in interface org.apache.openjpa.datacache.DataCache
Overrides:
addExpirationListener in class org.apache.openjpa.datacache.AbstractDataCache

getInternal

protected org.apache.openjpa.datacache.DataCachePCData getInternal(Object key)
Specified by:
getInternal in class org.apache.openjpa.datacache.AbstractDataCache

putInternal

protected org.apache.openjpa.datacache.DataCachePCData putInternal(Object key,
                                                                   org.apache.openjpa.datacache.DataCachePCData pc)
Specified by:
putInternal in class org.apache.openjpa.datacache.AbstractDataCache

removeInternal

protected org.apache.openjpa.datacache.DataCachePCData removeInternal(Object key)
Specified by:
removeInternal in class org.apache.openjpa.datacache.AbstractDataCache

removeAllInternal

protected void removeAllInternal(Class cls,
                                 boolean subclasses)
Specified by:
removeAllInternal in class org.apache.openjpa.datacache.AbstractDataCache

clearInternal

protected void clearInternal()
Specified by:
clearInternal in class org.apache.openjpa.datacache.AbstractDataCache

pinInternal

protected boolean pinInternal(Object key)
Coherence doesn't have a concept of expiring data, so pinning is meaningless. This method is equivalent to invoking Map.containsKey(java.lang.Object).

Specified by:
pinInternal in class org.apache.openjpa.datacache.AbstractDataCache

unpinInternal

protected boolean unpinInternal(Object key)
Coherence doesn't have a concept of expiring data, so unpinning is meaningless. This method is equivalent to invoking Map.containsKey(java.lang.Object).

Specified by:
unpinInternal in class org.apache.openjpa.datacache.AbstractDataCache

recacheUpdates

protected boolean recacheUpdates()
Tangosol does not automatically update objects stored in the cache, so we must re-enlist them as appropriate.

Overrides:
recacheUpdates in class org.apache.openjpa.datacache.AbstractDataCache

close

public void close()
Specified by:
close in interface org.apache.openjpa.datacache.DataCache
Specified by:
close in interface org.apache.openjpa.lib.util.Closeable
Overrides:
close in class org.apache.openjpa.datacache.AbstractDataCache

endConfiguration

public void endConfiguration()
Specified by:
endConfiguration in interface org.apache.openjpa.lib.conf.Configurable
Overrides:
endConfiguration in class org.apache.openjpa.datacache.AbstractDataCache

newTangosolCache

protected com.tangosol.net.NamedCache newTangosolCache(String name)
Returns a new NamedCache for use as the underlying data cache. This implementation returns a NamedCache obtained by invoking CacheFactory.getCache(java.lang.String) unless the TangosolCacheType optional DataCache property is set to distributed or to replicated, in which case CacheFactory.getDistributedCache(java.lang.String) or CacheFactory.getReplicatedCache(java.lang.String) are invoked, as appropriate. It uses the name specified by the TangosolCacheName property, or "kodo" if unset. To implement a more sophisticated caching strategy, override this method.


Kodo 4.1.0 generated on October 9 2006

Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.