|
GemFire 7.0 | ||||||||
| 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 extends PartitionListenerAdapter
implements 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 |
afterBucketCreated(int bucketId,
Iterable<?> keys)
Callback invoked after a bucket has been created in a member (e.g. during rebalancing). |
void |
afterBucketRemoved(int bucketId,
Iterable<?> keys)
Callback invoked after a bucket has been removed from a member (e.g. during rebalancing). |
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
void afterBucketRemoved(int bucketId,
Iterable<?> keys)
bucketId - id of the bucket removedkeys - keys in the bucket removed
void afterBucketCreated(int bucketId,
Iterable<?> keys)
bucketId - id of the bucket createdkeys - keys in the bucket created
|
GemFire 7.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||