You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/26 12:13:49 UTC
[21/21] ignite git commit: IGNITE-2236: Preparing.
IGNITE-2236: Preparing.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/060b2fbd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/060b2fbd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/060b2fbd
Branch: refs/heads/ignite-2236
Commit: 060b2fbdca9cac10a4c57824f26b3fb306350004
Parents: 863a951
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Sat Dec 26 14:14:19 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Sat Dec 26 14:14:19 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheMvccManager.java | 27 ++++++++------------
1 file changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/060b2fbd/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 c30bcb4..384130d 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
@@ -77,7 +77,12 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
private static final int MAX_REMOVED_LOCKS = 10240;
/** Pending locks per thread. */
- private final ThreadLocal<ArrayList<GridCacheMvccCandidate>> pending = new MvccCandidateThreadLocal();
+ private final ThreadLocal<LinkedList<GridCacheMvccCandidate>> pending =
+ new ThreadLocal<LinkedList<GridCacheMvccCandidate>>() {
+ @Override protected LinkedList<GridCacheMvccCandidate> initialValue() {
+ return new LinkedList<>();
+ }
+ };
/** Pending near local locks and topology version per thread. */
private ConcurrentMap<Long, GridCacheExplicitLockSpan> pendingExplicit;
@@ -721,14 +726,14 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
if (cacheCtx.isNear() || cand.singleImplicit())
return true;
- ArrayList<GridCacheMvccCandidate> pending0 = pending.get();
+ LinkedList<GridCacheMvccCandidate> queue = pending.get();
GridCacheMvccCandidate prev = null;
- if (!pending0.isEmpty())
- prev = pending0.get(pending0.size() - 1);
+ if (!queue.isEmpty())
+ prev = queue.getLast();
- pending0.add(cand);
+ queue.add(cand);
if (prev != null) {
prev.next(cand);
@@ -746,7 +751,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* Reset MVCC context.
*/
public void contextReset() {
- pending.get().clear();
+ pending.set(new LinkedList<GridCacheMvccCandidate>());
}
/**
@@ -1228,14 +1233,4 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
CachePartialUpdateCheckedException.class.isAssignableFrom(cls);
}
}
-
- /**
- * Thread local for pending MVCC candidates.
- */
- private static class MvccCandidateThreadLocal extends ThreadLocal<ArrayList<GridCacheMvccCandidate>> {
- /** {@inheritDoc} */
- @Override protected ArrayList<GridCacheMvccCandidate> initialValue() {
- return new ArrayList<>();
- }
- }
}