You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/04/29 01:09:58 UTC
[19/50] [abbrv] incubator-geode git commit: GEODE-1238: fix
EntryEventImpl already released
GEODE-1238: fix EntryEventImpl already released
DistributedPut/RemoveAllOperation now have getEventForPosition
as @Unretained. The callers of this method no longer release
since the operation will release these events already at the end
of its life.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/39b9edcf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/39b9edcf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/39b9edcf
Branch: refs/heads/feature/GEODE-1255
Commit: 39b9edcfea616027eb2dd4de98b7a51d787a4915
Parents: 44f403d
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Apr 25 17:32:26 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Tue Apr 26 15:38:07 2016 -0700
----------------------------------------------------------------------
.../cache/DistributedPutAllOperation.java | 13 +++++--------
.../cache/DistributedRemoveAllOperation.java | 19 ++++++++++---------
.../gemfire/internal/cache/FilterProfile.java | 13 +++----------
.../gemfire/internal/cache/LocalRegion.java | 12 ++----------
4 files changed, 20 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39b9edcf/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/39b9edcf/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/39b9edcf/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..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
@@ -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;
/**
@@ -1174,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) {
@@ -1214,9 +1214,6 @@ public class FilterProfile implements DataSerializableFixedID {
fi.setInterestedClientsInv(clientsInv);
}
ev.setLocalFilterInfo(fi);
- } finally {
- ev.release();
- }
}
}
}
@@ -1235,8 +1232,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 +1274,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/39b9edcf/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 c32a7d2..b3de9b7 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
@@ -10906,17 +10906,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();
- }
}
}
@@ -10933,15 +10929,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();
- }
}
}