ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [03/50] [abbrv] ignite git commit: IGNITE-2505: Cached entry in singleton list for IgniteTxImplicitSingleStateImpl do reduce GC pressure. This closes #443.
Date Fri, 18 Mar 2016 01:49:57 GMT
IGNITE-2505: Cached entry in singleton list for IgniteTxImplicitSingleStateImpl do reduce GC
pressure. This closes #443.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/057dfa7f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/057dfa7f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/057dfa7f

Branch: refs/heads/ignite-2407
Commit: 057dfa7f6df3783fc6cfa522fc3be5373d2c44f4
Parents: f687ba2
Author: Ilya Lantukh <ilantukh@gridgain.com>
Authored: Wed Mar 9 13:05:25 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Mar 9 13:05:25 2016 +0300

----------------------------------------------------------------------
 .../IgniteTxImplicitSingleStateImpl.java        | 24 +++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/057dfa7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
index baa029f..2f1e16f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.transactions;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.apache.ignite.IgniteCheckedException;
@@ -44,8 +45,8 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
     /** */
     private GridCacheContext cacheCtx;
 
-    /** */
-    private IgniteTxEntry entry;
+    /** Entry is stored as singleton list for performance optimization. */
+    private List<IgniteTxEntry> entry;
 
     /** */
     private boolean init;
@@ -181,15 +182,15 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
 
     /** {@inheritDoc} */
     @Override public IgniteTxEntry entry(IgniteTxKey key) {
-        if (entry != null && entry.txKey().equals(key))
-            return entry;
+        if (entry != null && entry.get(0).txKey().equals(key))
+            return entry.get(0);
 
         return null;
     }
 
     /** {@inheritDoc} */
     @Override public boolean hasWriteKey(IgniteTxKey key) {
-        return entry != null && entry.txKey().equals(key);
+        return entry != null && entry.get(0).txKey().equals(key);
     }
 
     /** {@inheritDoc} */
@@ -202,7 +203,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
         if (entry != null) {
             HashSet<IgniteTxKey> set = new HashSet<>(3, 0.75f);
 
-            set.add(entry.txKey());
+            set.add(entry.get(0).txKey());
 
             return set;
         }
@@ -212,7 +213,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
 
     /** {@inheritDoc} */
     @Override public Collection<IgniteTxEntry> writeEntries() {
-        return entry != null ? Collections.singletonList(entry) : Collections.<IgniteTxEntry>emptyList();
+        return entry != null ? entry : Collections.<IgniteTxEntry>emptyList();
     }
 
     /** {@inheritDoc} */
@@ -222,7 +223,8 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
 
     /** {@inheritDoc} */
     @Override public Map<IgniteTxKey, IgniteTxEntry> writeMap() {
-        return entry != null ? F.asMap(entry.txKey(), entry) : Collections.<IgniteTxKey,
IgniteTxEntry>emptyMap();
+        return entry != null ? F.asMap(entry.get(0).txKey(), entry.get(0)) :
+            Collections.<IgniteTxKey, IgniteTxEntry>emptyMap();
     }
 
     /** {@inheritDoc} */
@@ -237,7 +239,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
 
     /** {@inheritDoc} */
     @Override public Collection<IgniteTxEntry> allEntries() {
-        return entry != null ? Collections.singletonList(entry) : Collections.<IgniteTxEntry>emptyList();
+        return entry != null ? entry : Collections.<IgniteTxEntry>emptyList();
     }
 
     /** {@inheritDoc} */
@@ -260,7 +262,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
     @Override public void addEntry(IgniteTxEntry entry) {
         assert this.entry == null : "Entry already set [cur=" + this.entry + ", new=" + entry
+ ']';
 
-        this.entry = entry;
+        this.entry = Collections.singletonList(entry);
     }
 
     /** {@inheritDoc} */
@@ -270,7 +272,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter
{
 
     /** {@inheritDoc} */
     @Override public IgniteTxEntry singleWrite() {
-        return entry;
+        return entry != null ? entry.get(0) : null;
     }
 
     /** {@inheritDoc} */


Mime
View raw message