ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [07/11] ignite git commit: IGNITE-2264: Encapsulated "clientFirst" flag setter.
Date Sun, 03 Jan 2016 20:17:23 GMT
IGNITE-2264: Encapsulated "clientFirst" flag setter.


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

Branch: refs/heads/ignite-2264
Commit: 84dc8bbbb8850c4c29a728062fe55a59ddef86f4
Parents: 7bd1ff1
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Sun Jan 3 23:14:34 2016 +0400
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Sun Jan 3 23:14:34 2016 +0400

----------------------------------------------------------------------
 .../distributed/GridDistributedTxMapping.java   | 21 ++++++++++++--------
 ...arOptimisticSerializableTxPrepareFuture.java |  8 +++++---
 .../near/GridNearOptimisticTxPrepareFuture.java |  8 +++++---
 3 files changed, 23 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/84dc8bbb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
index 743b37b..4009c12 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
@@ -79,7 +79,7 @@ public class GridDistributedTxMapping implements Externalizable {
      * @param node Mapped node.
      */
     public GridDistributedTxMapping(ClusterNode node) {
-        this(node, false);
+        this(node, false, false);
     }
 
     /**
@@ -89,8 +89,20 @@ public class GridDistributedTxMapping implements Externalizable {
      * @param near Near flag.
      */
     public GridDistributedTxMapping(ClusterNode node, boolean near) {
+        this(node, near, false);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param node Mapped node.
+     * @param near Near flag.
+     * @param clientFirst Client first flag.
+     */
+    public GridDistributedTxMapping(ClusterNode node, boolean near, boolean clientFirst)
{
         this.node = node;
         this.near = near;
+        this.clientFirst = clientFirst;
 
         entries = new LeanSet<>(LeanSet.<IgniteTxEntry>linkedHashSetFactory());
     }
@@ -117,13 +129,6 @@ public class GridDistributedTxMapping implements Externalizable {
     }
 
     /**
-     * @param clientFirst {@code True} if this is first mapping for optimistic tx on client
node.
-     */
-    public void clientFirst(boolean clientFirst) {
-        this.clientFirst = clientFirst;
-    }
-
-    /**
      * @return {@code True} if mapping is for near caches, {@code false} otherwise.
      */
     public boolean near() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/84dc8bbb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 948c8ee..db22ea2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -560,7 +560,11 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
         GridDistributedTxMapping cur = curMapping.get(key);
 
         if (cur == null) {
-            cur = new GridDistributedTxMapping(primary, cacheCtx.isNear());
+            cur = new GridDistributedTxMapping(
+                primary,
+                cacheCtx.isNear(), /* Near */
+                !topLocked && cctx.kernalContext().clientNode() /* Client first.
*/
+            );
 
             curMapping.put(key, cur);
 
@@ -571,8 +575,6 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
                     tx.colocatedLocallyMapped(true);
             }
 
-            cur.clientFirst(!topLocked && cctx.kernalContext().clientNode());
-
             cur.last(true);
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/84dc8bbb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 85c5948..9f2ad9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -552,9 +552,11 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
         if (cur == null || !cur.node().id().equals(primary.id()) || cur.near() != cacheCtx.isNear())
{
             boolean clientFirst = cur == null && !topLocked && cctx.kernalContext().clientNode();
 
-            cur = new GridDistributedTxMapping(primary, cacheCtx.isNear());
-
-            cur.clientFirst(clientFirst);
+            cur = new GridDistributedTxMapping(
+                primary,
+                cacheCtx.isNear(), /* Near. */
+                clientFirst /* Client first. */
+            );
         }
 
         cur.add(entry);


Mime
View raw message