@Released(ENTRY_EVENT_OLD_VALUE)
  private void retainAndSetOldValue(@Retained(ENTRY_EVENT_OLD_VALUE) Object v) {
    if (v == oldValue) {
      return;
    }
    if (isOffHeapReference(v)) {
      StoredObject so = (StoredObject) v;
      if (ReferenceCountHelper.trackReferenceCounts()) {
        ReferenceCountHelper.setReferenceCountOwner(new OldValueOwner());
        boolean couldNotRetain = (!so.retain());
        ReferenceCountHelper.setReferenceCountOwner(null);
        if (couldNotRetain) {
          oldValue = null;
          oldValueBytes = null;
          return;
        }
      } else {
        if (!so.retain()) {
          oldValue = null;
          oldValueBytes = null;
          return;
        }
      }
    }
    basicSetOldValue(v);
  }
Note if v might be an off-heap reference that you did not retain for this EntryEventImpl then
call retainsAndSetOldValue instead of this method.

@param v the caller should have already retained this off-heap reference.
geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java