You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sa...@apache.org on 2016/12/08 06:11:37 UTC
[2/2] geode git commit: updated javadoc
updated javadoc
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/fe2e6a62
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/fe2e6a62
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/fe2e6a62
Branch: refs/heads/feature/GEODE-523
Commit: fe2e6a629a64cba4db24196b4dfc974a613d32ec
Parents: 3ae0f8a
Author: Sai Boorlagadda <sa...@apache.org>
Authored: Wed Dec 7 22:11:19 2016 -0800
Committer: Sai Boorlagadda <sa...@apache.org>
Committed: Wed Dec 7 22:11:19 2016 -0800
----------------------------------------------------------------------
.../cache/partition/PartitionListener.java | 46 +++++++-------------
1 file changed, 16 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/fe2e6a62/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
index 3aee284..a534e50 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionListener.java
@@ -20,51 +20,37 @@ import org.apache.geode.cache.Region;
/**
*
- * A callback for partitioned regions, invoked when a partition region is created or any bucket in a
- * partitioned region becomes primary.<br>
+ * A callback for partitioned regions, invoked when a partition region is created or any bucket is
+ * created/deleted or any bucket in a partitioned region becomes primary.<br>
* <br>
- * 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 : <br>
- *
+ * It is highly recommended that implementations of this listener should be quick and not try to
+ * manipulate regions and data because the the callbacks are invoked while holding locks that may
+ * block region operations. <br>
+ *
* <pre>
- * public class ColocatingPartitionListener extends PartitionListenerAdapter implements Declarable {
- * private Cache cache;
- *
- * private List<String> viewRegionNames = new ArrayList<String>();
- *
- * public ColocatingPartitionListener() {}
+ * package com.myCompany.MyPartitionListener;
+ *
+ * public class MyPartitionListener extends PartitionListenerAdapter implements Declarable {
+ * private String regionName;
+ *
+ * public MyPartitionListener() {}
*
* 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());
- * }
+ * System.out.println("bucket:" + bucketId + " has become primary on " + this.regionName);
* }
*
* public void afterRegionCreate(Region<?, ?> region) {
- * cache = region.getCache();
+ * this.regionName = region.getName();
* }
* }
* </pre>
*
- * A sample declaration of the ColocatingPartitionListener in cache.xml as follows :<br>
+ * A sample declaration of the MyPartitionListener in cache.xml as follows :<br>
*
* <pre>
* <partition-attributes redundant-copies="1">
* <partition-listener>
- * <class-name>com.myCompany.ColocatingPartitionListener</class-name>
- * <parameter name="viewRegions">
- * <string>/customer/ViewA,/customer/ViewB</string>
- * </parameter>
+ * <class-name>com.myCompany.MyPartitionListener</class-name>
* </partition-listener>
* </partition-attributes>
* </pre>