IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.openjpa
Class ObjectGridQueryCache

java.lang.Object
  extended by org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
      extended by org.apache.openjpa.datacache.AbstractQueryCache
          extended by com.ibm.websphere.objectgrid.openjpa.ObjectGridQueryCache
All Implemented Interfaces:
Serializable, QueryCache, TypesChangedListener, RemoteCommitListener, Configurable, Closeable, EventManager

public class ObjectGridQueryCache
extends AbstractQueryCache
implements RemoteCommitListener

A QueryCache implementation is a QueryCache plugin to integrate OpenJPA with ObjectGrid for leveraging the cluster server advantages provided by ObjectGrid. See ObjectGridDataCache for detail configuration information.

Since:
WAS XD 6.1.0.3
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.openjpa.datacache.AbstractQueryCache
conf, log
 
Fields inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
_listeners
 
Constructor Summary
ObjectGridQueryCache()
           
 
Method Summary
protected  void clearInternal()
          Clear the query cache
 void close()
          Close this query cache
protected  QueryResult getInternal(QueryKey qk)
          Returns a query result for a given query 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 whether reading from the replica is enabled
 void initialize(DataCacheManager mgr)
          Sets the configuration for initializing Query Cache
protected  Collection keySet()
           
protected  boolean pinInternal(QueryKey qk)
          This is not applicable to ObjectGrid
protected  QueryResult putInternal(QueryKey qk, QueryResult qr)
          Caches a query result set with a given query key
protected  QueryResult removeInternal(QueryKey qk)
          Removes the result set associated with the given query 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
protected  boolean unpinInternal(QueryKey qk)
          This is not applicable to ObjectGrid
 void writeLock()
          writeLock is for synchroning the update on the cache.
 void writeUnlock()
          Releases writeLock, paired with writeLock() for update synchronization
 
Methods inherited from class org.apache.openjpa.datacache.AbstractQueryCache
addTypesChangedListener, afterCommit, clear, close, endConfiguration, fireEvent, get, isClosed, newListenerCollection, onTypesChanged, pin, put, remove, removeAllInternal, removeTypesChangedListener, setConfiguration, startConfiguration, unpin
 
Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
addListener, fireEvent, getListeners, hasListener, hasListeners, isFailFast, removeListener, setFailFast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.event.RemoteCommitListener
afterCommit
 

Constructor Detail

ObjectGridQueryCache

public ObjectGridQueryCache()
Method Detail

initialize

public void initialize(DataCacheManager mgr)
Sets the configuration for initializing Query Cache

Specified by:
initialize in interface QueryCache
Overrides:
initialize in class AbstractQueryCache
See Also:
QueryCache.initialize(org.apache.openjpa.datacache.DataCacheManager)

writeLock

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.

Specified by:
writeLock in interface QueryCache
See Also:
QueryCache.writeLock()

writeUnlock

public void writeUnlock()
Releases writeLock, paired with writeLock() for update synchronization

Specified by:
writeUnlock in interface QueryCache
See Also:
QueryCache.writeUnlock()

getInternal

protected QueryResult getInternal(QueryKey qk)
Returns a query result for a given query key

Specified by:
getInternal in class AbstractQueryCache
See Also:
AbstractQueryCache.getInternal(org.apache.openjpa.datacache.QueryKey)

putInternal

protected QueryResult putInternal(QueryKey qk,
                                  QueryResult qr)
Caches a query result set with a given query key

Specified by:
putInternal in class AbstractQueryCache
See Also:
AbstractQueryCache.putInternal(org.apache.openjpa.datacache.QueryKey, org.apache.openjpa.datacache.QueryResult)

removeInternal

protected QueryResult removeInternal(QueryKey qk)
Removes the result set associated with the given query key

Specified by:
removeInternal in class AbstractQueryCache
See Also:
AbstractQueryCache.removeInternal(org.apache.openjpa.datacache.QueryKey)

clearInternal

protected void clearInternal()
Clear the query cache

Specified by:
clearInternal in class AbstractQueryCache
See Also:
AbstractQueryCache.clearInternal()

pinInternal

protected boolean pinInternal(QueryKey qk)
This is not applicable to ObjectGrid

Specified by:
pinInternal in class AbstractQueryCache
See Also:
AbstractQueryCache.pinInternal(org.apache.openjpa.datacache.QueryKey)

unpinInternal

protected boolean unpinInternal(QueryKey qk)
This is not applicable to ObjectGrid

Specified by:
unpinInternal in class AbstractQueryCache
See Also:
AbstractQueryCache.unpinInternal(org.apache.openjpa.datacache.QueryKey)

setMaxUsedMemory

public void setMaxUsedMemory(String maxUsedMemory)
Sets whether memory based eviction is enabled


getMaxUsedMemory

public String getMaxUsedMemory()
Returns setting of whether memory based eviction is enabled


setObjectGridName

public void setObjectGridName(String name)
Sets the name of the ObjectGrid that handles the cache


getObjectGridName

public String getObjectGridName()
Returns the name of the ObjectGrid that handel the cache


setObjectGridType

public void setObjectGridType(String objectGridType)
Sets the ObjectGrid type. Valid values includ LOCAL, REMOTE, and EMBEDDED


getObjectGridType

public String getObjectGridType()
Returns the ObjectGrid type.


setNumberOfPartitions

public void setNumberOfPartitions(String number)
Sets the number of partitions to be used in the cache


getNumberOfPartitions

public String getNumberOfPartitions()
Returns the number of partitions used in the cache


setReplicaMode

public void setReplicaMode(String mode)
Sets the replica mode


getReplicaMode

public String getReplicaMode()
Returns the replica mode


setReplicaReadEnabled

public void setReplicaReadEnabled(String read)
Sets whether reading from replica is enabled


getReplicaReadEnabled

public String getReplicaReadEnabled()
Returns whether reading from the replica is enabled


getMaxNumberOfReplicas

public String getMaxNumberOfReplicas()
Returns the maximum number of replicas for the EMBEDDED or EMBEDDED_PARTITION ObjectGrid type


setMaxNumberOfReplicas

public void setMaxNumberOfReplicas(String numberOfReplicas)
Sets the maximum number of replicas for the EMBEDDED or EMBEDDED_PARTITION ObjectGrid type


getPlacementScope

public String getPlacementScope()
Retrieve the scope used for partition placement. Either DOMAIN_SCOPE or CONTAINER_SCOPE. DOMAIN_SCOPE corresponds to default partition placement behavior in which one primary shard will exist for each partition, within the scope of the entire domain. CONTAINER_SCOPE corresponds to intra-domain replication behavior in which each one primary shard will exist for each partition within the scope of each container.

Returns:
the placement scope for the grid
Since:
7.1.1

setPlacementScope

public void setPlacementScope(String scope)
Set the scope used for partition placement. Either DOMAIN_SCOPE or CONTAINER_SCOPE. DOMAIN_SCOPE corresponds to default partition placement behavior in which one primary shard will exist for each partition, within the scope of the entire domain. CONTAINER_SCOPE corresponds to intra-domain replication behavior in which each one primary shard will exist for each partition within the scope of each container.

Parameters:
scope - the placement scope for the grid
Since:
7.1.1

getPlacementScopeTopology

public String getPlacementScopeTopology()
Retrieve the link topology used to perform intradomain replication. Supported values are RING and HUB.

Returns:
the link topology
Since:
7.1.1

setPlacementScopeTopology

public void setPlacementScopeTopology(String scopeTopology)
Set the link topology used to perform intradomain replication. Supported values are RING and HUB.

Parameters:
scopeTopology - the link topology
Since:
7.1.1

keySet

protected Collection keySet()
Specified by:
keySet in class AbstractQueryCache
See Also:
AbstractQueryCache.keySet()

close

public void close()
Close this query cache

Specified by:
close in interface QueryCache
Specified by:
close in interface RemoteCommitListener
Specified by:
close in interface Closeable
Overrides:
close in class AbstractQueryCache
See Also:
AbstractQueryCache.close()

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.