public static boolean checkExpectedOldValue(@Unretained Object expectedOldValue,
      @Unretained Object actualValue, InternalRegion region) {

    if (Token.isInvalid(expectedOldValue)) {
      return actualValue == null || Token.isInvalid(actualValue);
    } else {
      boolean isCompressedOffHeap =
          region.getAttributes().getOffHeap() && region.getAttributes().getCompressor() != null;
      return ValueComparisonHelper
          .checkEquals(expectedOldValue, actualValue, isCompressedOffHeap, region.getCache());
    }
  }
@throws EntryNotFoundException if expectedOldValue is not null and is not equal to current
        value
geode-core/src/main/java/org/apache/geode/internal/cache/entries/AbstractRegionEntry.java