|
GemFire 6.0.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.gemstone.gemfire.cache.partition.PartitionRegionHelper
public final class PartitionRegionHelper
Utility methods for handling partitioned Regions, for example
during execution of Functions on a Partitioned
Region.
Example of a Function using utility methods:
public Serializable execute(FunctionContext context) {
if (context instanceof RegionFunctionContext) {
RegionFunctionContext rc = (RegionFunctionContext) context;
if (PartitionRegionHelper.isPartitionedRegion(rc.getDataSet())) {
Region efficientReader =
PartitionRegionHelper.getLocalDataForContext(rc);
efficientReader.get("someKey");
// ...
}
}
// ...
FunctionService.onRegion(Region)| Method Summary | ||
|---|---|---|
static void |
assignBucketsToPartitions(Region<?,?> region)
Decide which partitions will host which buckets. |
|
static
|
getAllMembersForKey(Region<K,V> r,
K key)
Get all potential owners for a key. |
|
static Map<String,Region<?,?>> |
getColocatedRegions(Region<?,?> r)
Given a partitioned Region, return a map of colocated Regions. |
|
static Map<String,Region<?,?>> |
getLocalColocatedRegions(RegionFunctionContext c)
Given a RegionFunctionContext for a partitioned Region, return a map of colocated Regions with read access limited to the context of the function. |
|
static
|
getLocalData(Region<K,V> r)
Given a partitioned Region return a Region providing read access limited to the local heap, writes using this Region have no constraints and behave the same as a partitioned Region. |
|
static
|
getLocalDataForContext(RegionFunctionContext c)
Given a RegionFunctionContext for a partitioned Region, return a Region providing read access limited to the function context. |
|
static Set<PartitionRegionInfo> |
getPartitionRegionInfo(Cache cache)
Gathers a set of details about all partitioned regions in the local Ca@since 6.0che. |
|
static PartitionRegionInfo |
getPartitionRegionInfo(Region<?,?> region)
Gathers details about the specified partitioned region. |
|
static
|
getPrimaryMemberForKey(Region<K,V> r,
K key)
Get the current primary owner for a key. |
|
static
|
getRedundantMembersForKey(Region<K,V> r,
K key)
Get all potential redundant owners for a key. |
|
static boolean |
isPartitionedRegion(Region<?,?> r)
Test a Region to see if it is a partitioned Region |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Map<String,Region<?,?>> getColocatedRegions(Region<?,?> r)
r - a partitioned Region
Region
IllegalStateException - if the Region is not a partitioned Regionpublic static Map<String,Region<?,?>> getLocalColocatedRegions(RegionFunctionContext c)
Writes using these Region have no constraints and behave the same as a partitioned Region.
If there are no colocated regions, return an empty map.
c - the region function context
Region
IllegalStateException - if the Region is not a partitioned Regionpublic static <K,V> Region<K,V> getLocalDataForContext(RegionFunctionContext c)
Writes using this Region have no constraints and behave the same as a partitioned Region.
c - a functions context
IllegalStateException - if RegionFunctionContext.getDataSet() returns
something other than a partitioned Regionpublic static <K,V> Region<K,V> getLocalData(Region<K,V> r)
r - a partitioned region
IllegalStateException - if the provided region is something other than a
partitioned Regionpublic static boolean isPartitionedRegion(Region<?,?> r)
r -
public static Set<PartitionRegionInfo> getPartitionRegionInfo(Cache cache)
cache - the cache which has the regions
public static PartitionRegionInfo getPartitionRegionInfo(Region<?,?> region)
region - the region to get info about
public static void assignBucketsToPartitions(Region<?,?> region)
region - The region which should have it's buckets assigned.
IllegalStateException - if the provided region is something other than a
partitioned Region
public static <K,V> DistributedMember getPrimaryMemberForKey(Region<K,V> r,
K key)
This method is not a substitute for Region.containsKey(Object).
r - a PartitionedRegionkey - the key to evaluate
IllegalStateException - if the provided region is something other than a
partitioned Region
public static <K,V> Set<DistributedMember> getRedundantMembersForKey(Region<K,V> r,
K key)
This method is not a substitute for Region.containsKey(Object).
This method is equivalent to:
DistributedMember primary = getPrimaryMemberForKey(r, key);
Set extends DistributedMember> allMembers = getAllMembersForKey(r, key);
allMembers.remove(primary);
r - a PartitionedRegionkey - the key to evaluate
IllegalStateException - if the provided region is something other than a
partitioned Region
public static <K,V> Set<DistributedMember> getAllMembersForKey(Region<K,V> r,
K key)
This method is not a substitute for Region.containsKey(Object).
r - PartitionedRegionkey - the key to evaluate
IllegalStateException - if the provided region is something other than a
partitioned Region
|
GemFire 6.0.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||