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 3B2E9200B8C for ; Mon, 12 Sep 2016 10:26:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3A0D8160AC8; Mon, 12 Sep 2016 08:26:19 +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 22EAF160AE7 for ; Mon, 12 Sep 2016 10:26:17 +0200 (CEST) Received: (qmail 14136 invoked by uid 500); 12 Sep 2016 08:26:17 -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 13469 invoked by uid 99); 12 Sep 2016 08:26:16 -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; Mon, 12 Sep 2016 08:26:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3CC74EF9A3; Mon, 12 Sep 2016 08:26:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Mon, 12 Sep 2016 08:26:36 -0000 Message-Id: In-Reply-To: <8eb329ee1f544101a6a37883051b8e88@git.apache.org> References: <8eb329ee1f544101a6a37883051b8e88@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [22/46] ignite git commit: IGNITE-2833: GridCacheTtlManager pending queue retention size optimization. archived-at: Mon, 12 Sep 2016 08:26:19 -0000 IGNITE-2833: GridCacheTtlManager pending queue retention size optimization. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/35508295 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/35508295 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/35508295 Branch: refs/heads/master Commit: 355082958b476009179254df9be20e225179cb7c Parents: 2c397d2 Author: Andrey V. Mashenkov Authored: Mon Sep 5 18:06:27 2016 +0300 Committer: vozerov-gridgain Committed: Mon Sep 5 18:06:27 2016 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheTtlManager.java | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/35508295/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 ae2895e..8ff0358 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 @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache; import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.configuration.CacheConfiguration; @@ -106,7 +107,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { break; } - } else + } + else break; } } @@ -156,10 +158,11 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { if (log.isTraceEnabled()) log.trace("Trying to remove expired entry from cache: " + e); - GridCacheEntryEx entry = e.entry; boolean touch = false; + GridCacheEntryEx entry = e.ctx.cache().entryEx(e.key); + while (true) { try { if (entry.onTtlExpired(obsoleteVer)) @@ -278,8 +281,11 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { /** Entry expire time. */ private final long expireTime; - /** Entry. */ - private final GridCacheMapEntry entry; + /** Cache Object Context */ + private final GridCacheContext ctx; + + /** Cache Object Key */ + private final CacheObject key; /** * @param entry Cache entry to create wrapper for. @@ -289,7 +295,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { assert expireTime != 0; - this.entry = entry; + this.ctx = entry.context(); + this.key = entry.key(); } /** {@inheritDoc} */ @@ -297,7 +304,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { int res = Long.compare(expireTime, o.expireTime); if (res == 0) - res = compareKeys(entry.context(), entry.key(), o.entry.context(), o.entry.key()); + res = compareKeys(ctx, key, o.ctx, o.key); return res; } @@ -312,15 +319,14 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter { EntryWrapper that = (EntryWrapper)o; - return expireTime == that.expireTime && - compareKeys(entry.context(), entry.key(), that.entry.context(), that.entry.key()) == 0; + return expireTime == that.expireTime && compareKeys(ctx, key, that.ctx, that.key) == 0; } /** {@inheritDoc} */ @Override public int hashCode() { int res = (int)(expireTime ^ (expireTime >>> 32)); - res = 31 * res + entry.key().hashCode(); + res = 31 * res + key.hashCode(); return res; }