Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EC2741809A for ; Sat, 5 Mar 2016 00:52:23 +0000 (UTC) Received: (qmail 32073 invoked by uid 500); 5 Mar 2016 00:52:18 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 32044 invoked by uid 500); 5 Mar 2016 00:52:18 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 32035 invoked by uid 99); 5 Mar 2016 00:52:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Mar 2016 00:52:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 51DFFC08E8 for ; Sat, 5 Mar 2016 00:52:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id es-OfqXQUZo4 for ; Sat, 5 Mar 2016 00:52:17 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 2F21E5FBC4 for ; Sat, 5 Mar 2016 00:52:17 +0000 (UTC) Received: (qmail 29070 invoked by uid 99); 5 Mar 2016 00:51:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Mar 2016 00:51:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 78EEEE0007; Sat, 5 Mar 2016 00:51:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dschneider@apache.org To: commits@geode.incubator.apache.org Date: Sat, 05 Mar 2016 00:51:19 -0000 Message-Id: <1e47127abdeb42ccb9a1cefc8ec476c6@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [19/38] incubator-geode git commit: fixed a bug in getOffHeapNewValue and getOffHeapOldValue that caused them to return null when the value was stored in an address fixed a bug in getOffHeapNewValue and getOffHeapOldValue that caused them to return null when the value was stored in an address Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f97fd21b Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f97fd21b Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f97fd21b Branch: refs/heads/feature/GEODE-982 Commit: f97fd21bc215cdb67baee6e881e9a59df5af25d7 Parents: 9904fc6 Author: Darrel Schneider Authored: Tue Mar 1 16:24:07 2016 -0800 Committer: Darrel Schneider Committed: Tue Mar 1 16:24:07 2016 -0800 ---------------------------------------------------------------------- .../gemfire/internal/cache/EntryEventImpl.java | 31 ++++++++------------ 1 file changed, 13 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f97fd21b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java index e8ca3ce..37a6cf0 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java @@ -1519,16 +1519,7 @@ public class EntryEventImpl */ @Retained(ENTRY_EVENT_NEW_VALUE) public StoredObject getOffHeapNewValue() { - final Object tmp = basicGetNewValue(); - if (tmp instanceof ObjectStoredOffHeap) { - ObjectStoredOffHeap result = (ObjectStoredOffHeap) tmp; - if (!result.retain()) { - return null; - } - return result; - } else { - return null; - } + return convertToStoredObject(basicGetNewValue()); } /** @@ -1537,18 +1528,22 @@ public class EntryEventImpl */ @Retained(ENTRY_EVENT_OLD_VALUE) public StoredObject getOffHeapOldValue() { - final Object tmp = basicGetOldValue(); - if (tmp instanceof ObjectStoredOffHeap) { - ObjectStoredOffHeap result = (ObjectStoredOffHeap) tmp; - if (!result.retain()) { + return convertToStoredObject(basicGetOldValue()); + } + + private static StoredObject convertToStoredObject(final Object tmp) { + if (!(tmp instanceof StoredObject)) { + return null; + } + StoredObject result = (StoredObject) tmp; + if (result instanceof ObjectStoredOffHeap) { + if (!((ObjectStoredOffHeap) result).retain()) { return null; } - return result; - } else { - return null; } + return result; } - + /** * Result may be unretained because sqlf getDeserializedForReading returns unretained. */