geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject incubator-geode git commit: GEODE-1289: remove @Retained from getValueInVM
Date Wed, 11 May 2016 17:42:00 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop f4a167998 -> 3ebcf1f75


GEODE-1289: remove @Retained from getValueInVM

@Retained has been removed from the getValueInVM declaration
and callers have been changed to no longer act as if the result
of getValueInVM might be off-heap.


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

Branch: refs/heads/develop
Commit: 3ebcf1f750f3692179219b80737a39289d90c72d
Parents: f4a1679
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Tue May 10 16:12:56 2016 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Wed May 11 10:40:26 2016 -0700

----------------------------------------------------------------------
 .../query/internal/index/AbstractIndex.java     | 12 +--------
 .../internal/cache/AbstractRegionEntry.java     | 12 +++------
 .../internal/cache/AbstractRegionMap.java       | 26 +++-----------------
 .../gemfire/internal/cache/RegionEntry.java     |  2 --
 4 files changed, 8 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ebcf1f7/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
index 96e83b2..393428b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
@@ -1472,23 +1472,13 @@ public abstract class AbstractIndex implements IndexProtocol
         valuesInRegion = evaluateIndexIteratorsFromRE(re, context);
         valueInIndex = verifyAndGetPdxDomainObject(value);
       } else{
-        @Released Object val = re.getValueInVM(context.getPartitionedRegion());
-        StoredObject valToFree = null;
-        if (val instanceof StoredObject) {
-          valToFree = (StoredObject)val;
-        }
-        try {
+        Object val = re.getValueInVM(context.getPartitionedRegion());
         if (val instanceof CachedDeserializable) {
           val = ((CachedDeserializable)val).getDeserializedValue(getRegion(), re);
         }
         val = verifyAndGetPdxDomainObject(val);   
         valueInIndex = verifyAndGetPdxDomainObject(value);
         valuesInRegion = evaluateIndexIteratorsFromRE(val, context);
-        } finally {
-          if (valToFree != null) {
-            valToFree.release();
-          }
-        }
       }
     } catch (Exception e) {
       // TODO: Create a new LocalizedString for this.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ebcf1f7/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
index 481c3be..25cc818 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionEntry.java
@@ -557,20 +557,18 @@ public abstract class AbstractRegionEntry implements RegionEntry,
   }
   
   
-  @Retained
   public final Object getValueInVM(RegionEntryContext context) {
     ReferenceCountHelper.createReferenceCountOwner();
-    @Retained Object v = _getValueRetain(context, true);
+    @Released Object v = _getValueRetain(context, true);
     
     if (v == null) { // should only be possible if disk entry
       v = Token.NOT_AVAILABLE;
     }
-    @Retained Object result = OffHeapHelper.copyAndReleaseIfNeeded(v);
+    Object result = OffHeapHelper.copyAndReleaseIfNeeded(v);
     ReferenceCountHelper.setReferenceCountOwner(null);
     return result;
   }
   
-  @Retained
   public  Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner) {
    return getValueInVM(owner);
   }
@@ -642,8 +640,7 @@ public abstract class AbstractRegionEntry implements RegionEntry,
         // Because the pr meta data region will not have an LRU.
         newValueToWrite = ((CachedDeserializable) newValueToWrite).getDeserializedValue(region,
null);
         if (!create && newValueToWrite instanceof Versionable) {
-          @Retained @Released final Object oldValue = getValueInVM(region); // Heap value
should always be deserialized at this point // OFFHEAP will not be deserialized
-          try {
+          final Object oldValue = getValueInVM(region); // Heap value should always be deserialized
at this point // OFFHEAP will not be deserialized
           // BUGFIX for 35029. If oldValue is null the newValue should be put.
           if(oldValue == null) {
           	putValue = true;
@@ -653,9 +650,6 @@ public abstract class AbstractRegionEntry implements RegionEntry,
             Versionable ov = (Versionable) oldValue;
             putValue = nv.isNewerThan(ov);
           }  
-          } finally {
-            OffHeapHelper.release(oldValue);
-          }
         }
       }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ebcf1f7/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
index 75a1e32..5248d3d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
@@ -1588,8 +1588,7 @@ public abstract class AbstractRegionMap implements RegionMap {
           synchronized (re) {
             if (!re.isRemoved() || re.isTombstone()) {
               EntryEventImpl sqlfEvent = null;
-              @Retained @Released Object oldValue = re.getValueInVM(owner);
-              try {
+              Object oldValue = re.getValueInVM(owner);
               final int oldSize = owner.calculateRegionEntryValueSize(re);
               // Create an entry event only if the calling context is
               // a receipt of a TXCommitMessage AND there are callbacks installed
@@ -1672,9 +1671,6 @@ public abstract class AbstractRegionMap implements RegionMap {
               } finally {
                 if (!cbEventInPending) cbEvent.release();
               }
-              } finally {
-                OffHeapHelper.release(oldValue);
-              }
             }
           }
         } finally {
@@ -1959,18 +1955,14 @@ public abstract class AbstractRegionMap implements RegionMap {
                       if (!oldRe.isRemoved() && 
                           (fp != null && fp.getCqCount() > 0)) {
                         
-                        @Retained @Released Object oldValue = oldRe.getValueInVM(owner);
// OFFHEAP EntryEventImpl oldValue
+                        Object oldValue = oldRe.getValueInVM(owner); // OFFHEAP EntryEventImpl
oldValue
                         
                         // this will not fault in the value.
-                        try {
                         if (oldValue == Token.NOT_AVAILABLE){
                           event.setOldValue(oldRe.getValueOnDiskOrBuffer(owner));
                         } else {
                           event.setOldValue(oldValue);
                         }
-                        } finally {
-                          OffHeapHelper.release(oldValue);
-                        }
                       }
                       boolean isCreate = false;
                       try {
@@ -2196,14 +2188,8 @@ public abstract class AbstractRegionMap implements RegionMap {
                     if (re.isValueNull()) {
                       event.setOldValue(re.getValueOnDiskOrBuffer(owner));
                     } else {
-                      
-                      @Retained @Released Object v = re.getValueInVM(owner);
-                      
-                      try {
-                        event.setOldValue(v); // OFFHEAP escapes to EntryEventImpl oldValue
-                      } finally {
-                        OffHeapHelper.release(v);
-                      }
+                      Object v = re.getValueInVM(owner);
+                      event.setOldValue(v); // OFFHEAP escapes to EntryEventImpl oldValue
                     }
                   }
                   final boolean oldWasTombstone = re.isTombstone();
@@ -2400,7 +2386,6 @@ public abstract class AbstractRegionMap implements RegionMap {
                     final boolean oldWasTombstone = oldRe.isTombstone();
                     final int oldSize = owner.calculateRegionEntryValueSize(oldRe);
                     Object oldValue = oldRe.getValueInVM(owner); // OFFHEAP eei
-                    try {
                     // Create an entry event only if the calling context is
                     // a receipt of a TXCommitMessage AND there are callbacks
                     // installed
@@ -2462,9 +2447,6 @@ public abstract class AbstractRegionMap implements RegionMap {
                     } finally {
                       if (!cbEventInPending) cbEvent.release();
                     }
-                    } finally {
-                      OffHeapHelper.release(oldValue);
-                    }
                   }
                 }
               }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ebcf1f7/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
index bedbf81..09aef2a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java
@@ -283,7 +283,6 @@ public interface RegionEntry {
    *
    * @see LocalRegion#getValueInVM
    */
-  @Retained
   public Object getValueInVM(RegionEntryContext context);
   /**
    * Returns the value of an entry as it resides on disk.  For
@@ -383,7 +382,6 @@ public interface RegionEntry {
    * return a temporary copy. For SQLFabric this is used during table scans in
    * queries when faulting in every value will be only an unnecessary overhead.
    */
-  @Retained
   public Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner);
 
   /**


Mime
View raw message