|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
| 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
com.ibm.websphere.objectgrid.openjpa.ObjectGridDataCache
public class ObjectGridDataCache
A DataCache implementation is a
DataCache plugin to integrate Open JPA with ObjectGrid for leveraging
the cluster server advantages provided by ObjectGrid.
ObjectGrid cache is enabled / disable for OpenJPA by setting the openjpa.DataCache and openjpa.QueryCache configuration properties in persistence.xml. The syntax for setting the property is as the following:
<property name="openjpa.DataCache" value="com.ibm.websphere.objectgrid.openjpa.ObjectGridDataCache(<property>=<value>,...)" /> <property name="openjpa.QueryCache" value="com.ibm.websphere.objectgrid.openjpa.ObjectGridQueryCache(<property>=<value>,...)" />
If both DataCache and QueryCache are enabled, the QueryCache will use the same configuration as DataCache, so the QueryCache does not need to have any property.
The following ObjectGrid related properties can apply to both DataCache and QueryCache:
The following is a configuration example of JPA persistence.xml file.
<property name="openjpa.DataCache" value="com.ibm.websphere.objectgrid.openjpa.ObjectGridDataCache(objectGridName=MyObjectGridName, objectGridType=EMBEDDED, MaxNumberOfReplicas=47)" /> <property name="openjpa.ObjectGridQueryCache" value="com.ibm.websphere.objectgrid.openjpa.ObjectGridQueryCache()" /> <property name="openjpa.RemoteCommitProvider" value="sjvm" />
| 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 | |
|---|---|
ObjectGridDataCache()
|
|
| Method Summary | |
|---|---|
protected void |
clearInternal()
Clear all maps for a PU. |
void |
close()
Close this data cache |
void |
commit(Collection additions,
Collection newUpdates,
Collection existingUpdates,
Collection deletes)
Commits a transaction |
Map |
getAll(List keys)
Returns a list of objects associated with the given keys |
protected DataCachePCData |
getInternal(Object key)
Returns an object for a given key |
String |
getMaxNumberOfReplicas()
Returns the maximum number of replicas for the EMBEDDED or EMBEDDED_PARTITION ObjectGrid type |
String |
getMaxUsedMemory()
Returns setting of whether memory based eviction is enabled |
String |
getNumberOfPartitions()
Returns the number of partitions used in the cache |
String |
getObjectGridName()
Returns the name of the ObjectGrid that handel the cache |
String |
getObjectGridType()
Returns the ObjectGrid type. |
String |
getPlacementScope()
Retrieve the scope used for partition placement. |
String |
getPlacementScopeTopology()
Retrieve the link topology used to perform intradomain replication. |
String |
getReplicaMode()
Returns the replica mode |
String |
getReplicaReadEnabled()
Returns setting of whether reading from the replica is enabled |
void |
initialize(DataCacheManager mgr)
Initialize this data cache |
protected boolean |
pinInternal(Object key)
This is not applicable to ObjectGrid |
protected void |
putAllInternal(Collection pcs)
Caches a collection of cache objects |
protected DataCachePCData |
putInternal(Object key,
DataCachePCData pc)
Caches an object by a given key |
protected boolean |
recacheUpdates()
Return true because ObjectGrid is a external cache
and updates to data already in the cache (either in commit(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)
or the AbstractDataCache.update(org.apache.openjpa.datacache.DataCachePCData)) should be put back into the cache. |
DataCachePCData |
remove(Object key)
Removes a cache object by a given key. |
protected void |
removeAllInternal(Class cls,
boolean subs)
Clear the map corresponding to the entity class |
protected void |
removeAllInternal(Collection keys)
Deletes a collection of objects from the cache. |
protected DataCachePCData |
removeInternal(Object key)
Deletes a cached object by a given key. |
void |
setMaxNumberOfReplicas(String numberOfReplicas)
Sets the maximum number of replicas for the EMBEDDED or EMBEDDED_PARTITION ObjectGrid type |
void |
setMaxUsedMemory(String maxUsedMemory)
Sets whether memory based eviction is enabled |
void |
setNumberOfPartitions(String number)
Sets the number of partitions to be used in the cache |
void |
setObjectGridName(String name)
Sets the name of the ObjectGrid that handles the cache |
void |
setObjectGridType(String objectGridType)
Sets the ObjectGrid type. |
void |
setPlacementScope(String scope)
Set the scope used for partition placement. |
void |
setPlacementScopeTopology(String scopeTopology)
Set the link topology used to perform intradomain replication. |
void |
setReplicaMode(String mode)
Sets the replica mode |
void |
setReplicaReadEnabled(String read)
Sets whether reading from replica is enabled |
void |
unpinAll(Class cls,
boolean subs)
This is not applicable to ObjectGrid |
protected boolean |
unpinInternal(Object key)
This is not applicable to ObjectGrid |
void |
writeLock()
Acquires write lock |
void |
writeUnlock()
Releases writeLock, paired with writeLock() for update synchronization |
| Methods inherited from class org.apache.openjpa.datacache.AbstractDataCache |
|---|
addExpirationListener, afterCommit, clear, close, contains, containsAll, endConfiguration, fireEvent, get, getEvictionSchedule, getName, isClosed, keyRemoved, pin, pinAll, pinAll, put, removeAll, removeAll, 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 |
| Constructor Detail |
|---|
public ObjectGridDataCache()
| Method Detail |
|---|
public void initialize(DataCacheManager mgr)
initialize in interface DataCacheinitialize in class AbstractDataCacheDataCache.initialize(org.apache.openjpa.datacache.DataCacheManager)public void unpinAll(Class cls,
boolean subs)
unpinAll in interface DataCacheunpinAll in class AbstractDataCacheAbstractDataCache.unpinAll(java.lang.Class, boolean)public void writeLock()
writeLock is for synchroning the update on the cache. Before any update to the cache, writeLock should be obtained and held until commit is done. After each commit, writeLock should be released (by calling writeUnlock()) for others to update the cache.
writeLock in interface DataCacheDataCache.writeLock()public void writeUnlock()
writeUnlock in interface DataCacheDataCache.writeUnlock()protected DataCachePCData getInternal(Object key)
getInternal in class AbstractDataCacheAbstractDataCache.getInternal(java.lang.Object)protected DataCachePCData putInternal(Object key,
DataCachePCData pc)
putInternal in class AbstractDataCacheAbstractDataCache.putInternal(java.lang.Object, org.apache.openjpa.datacache.DataCachePCData)protected void putAllInternal(Collection pcs)
putAllInternal in class AbstractDataCacheAbstractDataCache.putAllInternal(java.util.Collection)public DataCachePCData remove(Object key)
remove in interface DataCacheremove in class AbstractDataCacheAbstractDataCache.remove(java.lang.Object)protected DataCachePCData removeInternal(Object key)
removeInternal in class AbstractDataCacheAbstractDataCache.removeInternal(java.lang.Object)protected void removeAllInternal(Class cls,
boolean subs)
removeAllInternal in class AbstractDataCacheAbstractDataCache.removeAllInternal(java.lang.Class, boolean)protected void removeAllInternal(Collection keys)
removeAllInternal in class AbstractDataCacheAbstractDataCache.removeAllInternal(java.util.Collection)protected void clearInternal()
clearInternal in class AbstractDataCacheAbstractDataCache.clearInternal()protected boolean pinInternal(Object key)
pinInternal in class AbstractDataCacheAbstractDataCache.pinInternal(java.lang.Object)protected boolean unpinInternal(Object key)
unpinInternal in class AbstractDataCacheAbstractDataCache.unpinInternal(java.lang.Object)public void setMaxUsedMemory(String maxUsedMemory)
public String getMaxUsedMemory()
public void setObjectGridName(String name)
public String getObjectGridName()
public void setObjectGridType(String objectGridType)
public String getObjectGridType()
public void setNumberOfPartitions(String number)
public String getNumberOfPartitions()
public void setReplicaMode(String mode)
public String getReplicaMode()
public void setReplicaReadEnabled(String read)
public String getReplicaReadEnabled()
public String getMaxNumberOfReplicas()
public void setMaxNumberOfReplicas(String numberOfReplicas)
public String getPlacementScope()
public void setPlacementScope(String scope)
scope - the placement scope for the gridpublic String getPlacementScopeTopology()
public void setPlacementScopeTopology(String scopeTopology)
scopeTopology - the link topologypublic void commit(Collection additions,
Collection newUpdates,
Collection existingUpdates,
Collection deletes)
commit in interface DataCachecommit in class AbstractDataCacheAbstractDataCache.commit(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)public Map getAll(List keys)
getAll in interface DataCachegetAll in class AbstractDataCachekeys - the keys of the entries to retrieve.
AbstractDataCache.getAll(java.util.List)public void close()
close in interface DataCacheclose in interface RemoteCommitListenerclose in interface Closeableclose in class AbstractDataCacheAbstractDataCache.close()protected boolean recacheUpdates()
true because ObjectGrid is a external cache
and updates to data already in the cache (either in commit(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)
or the AbstractDataCache.update(org.apache.openjpa.datacache.DataCachePCData)) should be put back into the cache.
recacheUpdates in class AbstractDataCacheAbstractDataCache.recacheUpdates()
|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||