You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/07/24 22:15:36 UTC
incubator-ignite git commit: IGNITE-1159 - Removed queue iteration.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-1159 0341759c2 -> 45308bcb7
IGNITE-1159 - Removed queue iteration.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/45308bcb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/45308bcb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/45308bcb
Branch: refs/heads/ignite-1159
Commit: 45308bcb73664d65c0e93d56b0aa7672d085ec59
Parents: 0341759
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Fri Jul 24 13:15:28 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Fri Jul 24 13:15:28 2015 -0700
----------------------------------------------------------------------
.../processors/cache/GridCacheMvccManager.java | 44 ++++++--------------
1 file changed, 13 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45308bcb/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..44991c6 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<Queue<GridCacheMvccCandidate>> pending =
- new ThreadLocal<Queue<GridCacheMvccCandidate>>() {
- @Override protected Queue<GridCacheMvccCandidate> initialValue() {
+ private final ThreadLocal<LinkedList<GridCacheMvccCandidate>> pending =
+ new ThreadLocal<LinkedList<GridCacheMvccCandidate>>() {
+ @Override protected LinkedList<GridCacheMvccCandidate> initialValue() {
return new LinkedList<>();
}
};
@@ -751,43 +751,25 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
if (cacheCtx.isNear() || cand.singleImplicit())
return true;
- Queue<GridCacheMvccCandidate> queue = pending.get();
-
- boolean add = true;
+ LinkedList<GridCacheMvccCandidate> queue = pending.get();
GridCacheMvccCandidate prev = null;
- for (Iterator<GridCacheMvccCandidate> 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;
}
/**