Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 90C35200BB1 for ; Wed, 28 Sep 2016 15:05:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8FA33160ADD; Wed, 28 Sep 2016 13:05:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B5ED2160AED for ; Wed, 28 Sep 2016 15:05:21 +0200 (CEST) Received: (qmail 70732 invoked by uid 500); 28 Sep 2016 13:05:20 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 70481 invoked by uid 99); 28 Sep 2016 13:05:20 -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; Wed, 28 Sep 2016 13:05:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8BE08EEE1B; Wed, 28 Sep 2016 13:05:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Wed, 28 Sep 2016 13:05:29 -0000 Message-Id: <331180204560432cb3e057a3c726b6b1@git.apache.org> In-Reply-To: <3744adb908ad40d89504086e0458b490@git.apache.org> References: <3744adb908ad40d89504086e0458b490@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/15] ignite git commit: ignite-2833 Need call 'touch' for cache entry if it was obtained using 'entryEx'. archived-at: Wed, 28 Sep 2016 13:05:22 -0000 ignite-2833 Need call 'touch' for cache entry if it was obtained using 'entryEx'. (cherry picked from commit 17c2fc0) Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e3f13455 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e3f13455 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e3f13455 Branch: refs/heads/ignite-3601p Commit: e3f13455d4273e615727d0410783e3719db98f76 Parents: d595345 Author: sboikov Authored: Wed Sep 28 12:56:17 2016 +0300 Committer: sboikov Committed: Wed Sep 28 15:43:13 2016 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheTtlManager.java | 32 +++++++++++--------- .../cache/GridCacheAbstractFullApiSelfTest.java | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/e3f13455/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java index 996544f..0f855fe 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java @@ -129,26 +129,28 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { if (log.isTraceEnabled()) log.trace("Trying to remove expired entry from cache: " + e); - boolean touch = false; + boolean touch = e.ctx.isSwapOrOffheapEnabled(); - GridCacheEntryEx entry = e.ctx.cache().entryEx(e.key); + GridCacheEntryEx entry = touch ? e.ctx.cache().entryEx(e.key) : e.ctx.cache().peekEx(e.key); - while (true) { - try { - if (entry.onTtlExpired(obsoleteVer)) - touch = false; + if (entry != null) { + while (true) { + try { + if (entry.onTtlExpired(obsoleteVer)) + touch = false; - break; - } - catch (GridCacheEntryRemovedException e0) { - entry = entry.context().cache().entryEx(entry.key()); + break; + } + catch (GridCacheEntryRemovedException e0) { + entry = entry.context().cache().entryEx(entry.key()); - touch = true; + touch = true; + } } - } - if (touch) - entry.context().evicts().touch(entry, null); + if (touch) + entry.context().evicts().touch(entry, null); + } } } @@ -216,7 +218,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { private final GridCacheContext ctx; /** Cache Object Key */ - private final CacheObject key; + private final KeyCacheObject key; /** * @param entry Cache entry to create wrapper for. http://git-wip-us.apache.org/repos/asf/ignite/blob/e3f13455/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index a31c82e..e7daf2b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -4057,7 +4057,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract // Peek will actually remove entry from cache. assertNull(cache.localPeek(key)); - assert cache.localSize() == 0; + assertEquals(0, cache.localSize()); // Clear readers, if any. cache.remove(key);