|
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.Object org.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 DataCache
initialize
in class AbstractDataCache
DataCache.initialize(org.apache.openjpa.datacache.DataCacheManager)
public void unpinAll(Class cls, boolean subs)
unpinAll
in interface DataCache
unpinAll
in class AbstractDataCache
AbstractDataCache.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 DataCache
DataCache.writeLock()
public void writeUnlock()
writeUnlock
in interface DataCache
DataCache.writeUnlock()
protected DataCachePCData getInternal(Object key)
getInternal
in class AbstractDataCache
AbstractDataCache.getInternal(java.lang.Object)
protected DataCachePCData putInternal(Object key, DataCachePCData pc)
putInternal
in class AbstractDataCache
AbstractDataCache.putInternal(java.lang.Object, org.apache.openjpa.datacache.DataCachePCData)
protected void putAllInternal(Collection pcs)
putAllInternal
in class AbstractDataCache
AbstractDataCache.putAllInternal(java.util.Collection)
public DataCachePCData remove(Object key)
remove
in interface DataCache
remove
in class AbstractDataCache
AbstractDataCache.remove(java.lang.Object)
protected DataCachePCData removeInternal(Object key)
removeInternal
in class AbstractDataCache
AbstractDataCache.removeInternal(java.lang.Object)
protected void removeAllInternal(Class cls, boolean subs)
removeAllInternal
in class AbstractDataCache
AbstractDataCache.removeAllInternal(java.lang.Class, boolean)
protected void removeAllInternal(Collection keys)
removeAllInternal
in class AbstractDataCache
AbstractDataCache.removeAllInternal(java.util.Collection)
protected void clearInternal()
clearInternal
in class AbstractDataCache
AbstractDataCache.clearInternal()
protected boolean pinInternal(Object key)
pinInternal
in class AbstractDataCache
AbstractDataCache.pinInternal(java.lang.Object)
protected boolean unpinInternal(Object key)
unpinInternal
in class AbstractDataCache
AbstractDataCache.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 DataCache
commit
in class AbstractDataCache
AbstractDataCache.commit(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)
public Map getAll(List keys)
getAll
in interface DataCache
getAll
in class AbstractDataCache
keys
- the keys of the entries to retrieve.
AbstractDataCache.getAll(java.util.List)
public void close()
close
in interface DataCache
close
in interface RemoteCommitListener
close
in interface Closeable
close
in class AbstractDataCache
AbstractDataCache.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 AbstractDataCache
AbstractDataCache.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 |