|
GemFire 6.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PartitionListener
A callback for partitioned regions, invoked when a partition region is
created or any bucket in a partitioned region becomes primary
A sample implementation of this interface to colocate partition regions using
a primary key without having to honor the redundancy contract for every
colocate partition regions is as follows :
public class ColocatingPartitionListener implements PartitionListener, Declarable { private Cache cache; private List<String> viewRegionNames = new ArrayList<String>(); public ColocatingPartitionListener() { } public void afterPrimary(int bucketId) { for (String viewRegionName : viewRegionNames) { Region viewRegion = cache.getRegion(viewRegionName); PartitionManager.createPrimaryBucket(viewRegion, bucketId, true, true); } } public void init(Properties props) { String viewRegions = props.getProperty("viewRegions"); StringTokenizer tokenizer = new StringTokenizer(viewRegions, ","); while (tokenizer.hasMoreTokens()) { viewRegionNames.add(tokenizer.nextToken()); } } public void afterRegionCreate(Region<?, ?> region) { cache = region.getCache(); } }A sample declaration of the ColocatingPartitionListener in cache.xml as follows :
<partition-attributes redundant-copies="1"> <partition-listener> <class-name>com.myCompany.ColocatingPartitionListener</class-name> <parameter name="viewRegions"> <string>/customer/ViewA,/customer/ViewB</string> </parameter> </partition-listener> </partition-attributes>
Note : Please contact support@gemstone.com before using these APIs
Method Summary | |
---|---|
void |
afterPrimary(int bucketId)
Callback invoked when any bucket in a partitioned region becomes primary |
void |
afterRegionCreate(Region<?,?> region)
Callback invoked when a partition region is created |
Method Detail |
---|
void afterPrimary(int bucketId)
bucketId
- id of the bucket which became primaryvoid afterRegionCreate(Region<?,?> region)
region
- handle of the region which is created
|
GemFire 6.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |