You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/04/26 02:38:56 UTC

[1/2] incubator-geode git commit: removeAll getEventForPosition now @Unretained. Callers no longer release.

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1238-2 [created] 42bcd67b2


removeAll getEventForPosition now @Unretained. Callers no longer release.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/761bd38d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/761bd38d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/761bd38d

Branch: refs/heads/feature/GEODE-1238-2
Commit: 761bd38dc3d7cdecfc67ad9fb13bea5c156c6a26
Parents: 9fbcb93
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Apr 25 17:32:26 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Apr 25 17:32:26 2016 -0700

----------------------------------------------------------------------
 .../cache/DistributedRemoveAllOperation.java     | 19 ++++++++++---------
 .../gemfire/internal/cache/FilterProfile.java    |  7 ++-----
 .../gemfire/internal/cache/LocalRegion.java      |  6 +-----
 3 files changed, 13 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/761bd38d/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRemoveAllOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRemoveAllOperation.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRemoveAllOperation.java
index 34889aa..1d216ce 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRemoveAllOperation.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRemoveAllOperation.java
@@ -57,6 +57,7 @@ import com.gemstone.gemfire.internal.cache.versions.VersionTag;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.offheap.annotations.Released;
 import com.gemstone.gemfire.internal.offheap.annotations.Retained;
+import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
 
 /**
  * Handles distribution of a Region.removeAll operation.
@@ -67,7 +68,10 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
   {
   private static final Logger logger = LogService.getLogger();
 
-  protected final RemoveAllEntryData[] removeAllData;
+  /**
+   * Release is called by freeOffHeapResources.
+   */
+  @Retained protected final RemoveAllEntryData[] removeAllData;
 
   public int removeAllDataSize;
   
@@ -177,9 +181,9 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
       public boolean hasNext() {
         return DistributedRemoveAllOperation.this.removeAllDataSize > position;
       };
-      @Retained
+      @Unretained
       public Object next() {
-        @Retained EntryEventImpl ev = getEventForPosition(position);
+        @Unretained EntryEventImpl ev = getEventForPosition(position);
         position++;
         return ev;
       };
@@ -199,7 +203,7 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
     }
   }
 
-  @Retained
+  @Unretained
   public EntryEventImpl getEventForPosition(int position) {
     RemoveAllEntryData entry = this.removeAllData[position];
     if (entry == null) {
@@ -209,6 +213,7 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
       return entry.event;
     }
     LocalRegion region = (LocalRegion)this.event.getRegion();
+    // owned by this.removeAllData once entry.event = ev is done
     @Retained EntryEventImpl ev = EntryEventImpl.create(
         region,
         entry.getOp(),
@@ -572,17 +577,13 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
     }
     FilterRoutingInfo consolidated = new FilterRoutingInfo();
     for (int i=0; i<this.removeAllData.length; i++) {
-      @Released EntryEventImpl ev = getEventForPosition(i);
+      @Unretained EntryEventImpl ev = getEventForPosition(i);
       if (ev != null) {
-        try {
         FilterRoutingInfo eventRouting = advisor.adviseFilterRouting(ev, cacheOpRecipients);
         if (eventRouting != null) {
           consolidated.addFilterInfo(eventRouting);
         }
         removeAllData[i].filterRouting = eventRouting;
-        } finally {
-          ev.release();
-        }
       }
     }
     // we need to create routing information for each PUT event

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/761bd38d/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
index 65e7a84..f585977 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
@@ -74,6 +74,7 @@ import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.offheap.annotations.Released;
+import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
 import com.gemstone.gemfire.internal.util.concurrent.CopyOnWriteHashMap;
 
 /**
@@ -1235,8 +1236,7 @@ public class FilterProfile implements DataSerializableFixedID {
      for (int idx=0; idx < size; idx++) {
        RemoveAllEntryData pEntry = removeAllData[idx];
        if (pEntry != null) {
-         @Released final EntryEventImpl ev = op.getEventForPosition(idx);
-         try {
+         @Unretained final EntryEventImpl ev = op.getEventForPosition(idx);
          FilterRoutingInfo fri = pEntry.filterRouting;
          FilterInfo fi = null;
          if (fri != null) {
@@ -1278,9 +1278,6 @@ public class FilterProfile implements DataSerializableFixedID {
          //          this.region.getLogWriterI18n().fine("setting event routing to " + fi);
          //        }
          ev.setLocalFilterInfo(fi);
-         } finally {
-           ev.release();
-         }
        }
      }
    }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/761bd38d/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
index 4360b2a..1ff41a6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
@@ -10945,15 +10945,11 @@ public class LocalRegion extends AbstractRegion
       successfulKeys.add(key);
     }
     for (Iterator it=op.eventIterator(); it.hasNext(); ) {
-      @Released EntryEventImpl event = (EntryEventImpl)it.next();
-      try {
+      @Unretained EntryEventImpl event = (EntryEventImpl)it.next();
       if (successfulKeys.contains(event.getKey())) {
         invokeDestroyCallbacks(EnumListenerEvent.AFTER_DESTROY, event, !event.callbacksInvoked() && !event.isPossibleDuplicate(),
             false /* We must notify gateways inside RegionEntry lock, NOT here, to preserve the order of events sent by gateways for same key*/);
       }
-      } finally {
-        event.release();
-      }
     }
   }
   


[2/2] incubator-geode git commit: putAll getEventForPosition now @Unretained. Callers no longer release.

Posted by ds...@apache.org.
putAll getEventForPosition now @Unretained. Callers no longer release.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/42bcd67b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/42bcd67b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/42bcd67b

Branch: refs/heads/feature/GEODE-1238-2
Commit: 42bcd67b23f4fc9f684aaaf0cddd9ea7609df189
Parents: 761bd38
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Apr 25 17:38:12 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Apr 25 17:38:12 2016 -0700

----------------------------------------------------------------------
 .../internal/cache/DistributedPutAllOperation.java     | 13 +++++--------
 .../gemstone/gemfire/internal/cache/FilterProfile.java |  6 +-----
 .../gemstone/gemfire/internal/cache/LocalRegion.java   |  6 +-----
 3 files changed, 7 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/42bcd67b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedPutAllOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedPutAllOperation.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedPutAllOperation.java
index 4b4d4d3..2817fdd 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedPutAllOperation.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedPutAllOperation.java
@@ -63,6 +63,7 @@ import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.offheap.annotations.Released;
 import com.gemstone.gemfire.internal.offheap.annotations.Retained;
+import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
 
 /**
  * Handles distribution of a Region.putall operation.
@@ -195,9 +196,9 @@ public class DistributedPutAllOperation extends AbstractUpdateOperation
       public boolean hasNext() {
         return DistributedPutAllOperation.this.putAllDataSize > position;
       };
-      @Retained
+      @Unretained
       public Object next() {
-        @Retained EntryEventImpl ev = getEventForPosition(position);
+        @Unretained EntryEventImpl ev = getEventForPosition(position);
         position++;
         return ev;
       };
@@ -217,7 +218,7 @@ public class DistributedPutAllOperation extends AbstractUpdateOperation
     }
   }
   
-  @Retained
+  @Unretained
   public EntryEventImpl getEventForPosition(int position) {
     PutAllEntryData entry = this.putAllData[position];
     if (entry == null) {
@@ -816,17 +817,13 @@ public class DistributedPutAllOperation extends AbstractUpdateOperation
     }
     FilterRoutingInfo consolidated = new FilterRoutingInfo();
     for (int i=0; i<this.putAllData.length; i++) {
-      @Released EntryEventImpl ev = getEventForPosition(i);
+      @Unretained EntryEventImpl ev = getEventForPosition(i);
       if (ev != null) {
-        try {
         FilterRoutingInfo eventRouting = advisor.adviseFilterRouting(ev, cacheOpRecipients);
         if (eventRouting != null) {
           consolidated.addFilterInfo(eventRouting);
         }
         putAllData[i].filterRouting = eventRouting;
-        } finally {
-          ev.release();
-        }
       }
     }
     // we need to create routing information for each PUT event

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/42bcd67b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
index f585977..acd0fca 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/FilterProfile.java
@@ -1175,8 +1175,7 @@ public class FilterProfile implements DataSerializableFixedID {
       for (int idx=0; idx < size; idx++) {
         PutAllEntryData pEntry = putAllData[idx];
         if (pEntry != null) {
-          @Released final EntryEventImpl ev = dpao.getEventForPosition(idx);
-          try {
+          @Unretained final EntryEventImpl ev = dpao.getEventForPosition(idx);
           FilterRoutingInfo fri = pEntry.filterRouting;
           FilterInfo fi = null;
           if (fri != null) {
@@ -1215,9 +1214,6 @@ public class FilterProfile implements DataSerializableFixedID {
             fi.setInterestedClientsInv(clientsInv);
           }
           ev.setLocalFilterInfo(fi);
-          } finally {
-            ev.release();
-          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/42bcd67b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
index 1ff41a6..66d4a9a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
@@ -10918,17 +10918,13 @@ public class LocalRegion extends AbstractRegion
       successfulKeys.add(key);
     }
     for (Iterator it=putallOp.eventIterator(); it.hasNext(); ) {
-      @Released EntryEventImpl event = (EntryEventImpl)it.next();
-      try {
+      @Unretained EntryEventImpl event = (EntryEventImpl)it.next();
       if (successfulKeys.contains(event.getKey())) {
         EnumListenerEvent op = event.getOperation().isCreate() ? EnumListenerEvent.AFTER_CREATE
             : EnumListenerEvent.AFTER_UPDATE; 
         invokePutCallbacks(op, event, !event.callbacksInvoked() && !event.isPossibleDuplicate(),
             false /* We must notify gateways inside RegionEntry lock, NOT here, to preserve the order of events sent by gateways for same key*/);
       }
-      } finally {
-        event.release();
-      }
     }
   }