Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-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 736591811D for ; Sat, 1 Aug 2015 00:59:06 +0000 (UTC) Received: (qmail 50903 invoked by uid 500); 1 Aug 2015 00:59:06 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 50872 invoked by uid 500); 1 Aug 2015 00:59:06 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 50863 invoked by uid 99); 1 Aug 2015 00:59:06 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Aug 2015 00:59:06 +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 C2101D969C for ; Sat, 1 Aug 2015 00:59:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.373 X-Spam-Level: X-Spam-Status: No, score=0.373 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.428, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id hASq7Cdda7h9 for ; Sat, 1 Aug 2015 00:58:57 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 857622100B for ; Sat, 1 Aug 2015 00:58:57 +0000 (UTC) Received: (qmail 50853 invoked by uid 99); 1 Aug 2015 00:58:57 -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, 01 Aug 2015 00:58:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 414D1E04B3; Sat, 1 Aug 2015 00:58:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: # ignite-1159 Date: Sat, 1 Aug 2015 00:58:57 +0000 (UTC) Repository: incubator-ignite Updated Branches: refs/heads/master 3d9b9dfac -> 93b205758 # ignite-1159 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/93b20575 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/93b20575 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/93b20575 Branch: refs/heads/master Commit: 93b205758fea49f415802a7007e054e95f6af2c7 Parents: 3d9b9df Author: Alexey Goncharuk Authored: Fri Jul 31 17:34:34 2015 -0700 Committer: Alexey Goncharuk Committed: Fri Jul 31 17:53:18 2015 -0700 ---------------------------------------------------------------------- .../processors/cache/GridCacheMvccManager.java | 73 ++++---------------- .../processors/cache/GridCacheMvccSelfTest.java | 1 - 2 files changed, 13 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93b20575/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java index a0d9051..6a8c6fe 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java @@ -51,9 +51,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter { private static final int MAX_REMOVED_LOCKS = 10240; /** Pending locks per thread. */ - private final ThreadLocal> pending = - new ThreadLocal>() { - @Override protected Queue initialValue() { + private final ThreadLocal> pending = + new ThreadLocal>() { + @Override protected LinkedList initialValue() { return new LinkedList<>(); } }; @@ -708,35 +708,6 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter { } /** - * Unlinks a lock candidate. - * - * @param cand Lock candidate to unlink. - */ - private void unlink(GridCacheMvccCandidate cand) { - GridCacheMvccCandidate next = cand.next(); - - if (next != null) { - GridCacheMvccCandidate prev = cand.previous(); - - next.previous(prev); - - if (prev != null) - prev.next(next); - } - - /* - * Note that we specifically don't set links from passed in - * candidate to null because it is possible in some race - * cases that it will get traversed. However, it should - * still become available for GC and should not cause - * an issue. - */ - - if (log.isDebugEnabled()) - log.debug("Unlinked lock candidate: " + cand); - } - - /** * * @param cand Cache lock candidate to add. * @return {@code True} if added as a result of this operation, @@ -751,43 +722,25 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter { if (cacheCtx.isNear() || cand.singleImplicit()) return true; - Queue queue = pending.get(); - - boolean add = true; + LinkedList queue = pending.get(); GridCacheMvccCandidate prev = null; - for (Iterator it = queue.iterator(); it.hasNext(); ) { - GridCacheMvccCandidate c = it.next(); - - if (c.equals(cand)) - add = false; - - if (c.used()) { - it.remove(); + if (!queue.isEmpty()) + prev = queue.getLast(); - unlink(c); + queue.add(cand); - continue; - } + if (prev != null) { + prev.next(cand); - prev = c; + cand.previous(prev); } - if (add) { - queue.add(cand); - - if (prev != null) { - prev.next(cand); - - cand.previous(prev); - } - - if (log.isDebugEnabled()) - log.debug("Linked new candidate: " + cand); - } + if (log.isDebugEnabled()) + log.debug("Linked new candidate: " + cand); - return add; + return true; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93b20575/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java index be7e3c9..2a4365d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java @@ -1387,7 +1387,6 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest { ctx.mvcc().addNext(ctx, c4); - assert c3.previous() == null; assert c4 != null; assert c4.previous() == c3; }