ignite-commits mailing list archives

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


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

Branch: refs/heads/ignite-2264
Commit: 7bd1ff15d815b0b247bb1f59205a67bb2d519f1c
Parents: 775786c
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Sun Jan 3 23:09:46 2016 +0400
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Sun Jan 3 23:09:46 2016 +0400

----------------------------------------------------------------------
 .../distributed/GridDistributedTxMapping.java   | 20 +++++++++++++-------
 ...arOptimisticSerializableTxPrepareFuture.java |  5 +----
 .../near/GridNearOptimisticTxPrepareFuture.java |  5 +----
 .../GridNearPessimisticTxPrepareFuture.java     |  4 +---
 .../cache/distributed/near/GridNearTxLocal.java |  9 ++-------
 5 files changed, 18 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7bd1ff15/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 280cf3a..743b37b 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
@@ -74,10 +74,23 @@ public class GridDistributedTxMapping implements Externalizable {
     }
 
     /**
+     * Constructor.
+     *
      * @param node Mapped node.
      */
     public GridDistributedTxMapping(ClusterNode node) {
+        this(node, false);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param node Mapped node.
+     * @param near Near flag.
+     */
+    public GridDistributedTxMapping(ClusterNode node, boolean near) {
         this.node = node;
+        this.near = near;
 
         entries = new LeanSet<>(LeanSet.<IgniteTxEntry>linkedHashSetFactory());
     }
@@ -118,13 +131,6 @@ public class GridDistributedTxMapping implements Externalizable {
     }
 
     /**
-     * @param near {@code True} if mapping is for near caches, {@code false} otherwise.
-     */
-    public void near(boolean near) {
-        this.near = near;
-    }
-
-    /**
      * @return Node.
      */
     public ClusterNode node() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7bd1ff15/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 2090e04..948c8ee 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,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
         GridDistributedTxMapping cur = curMapping.get(key);
 
         if (cur == null) {
-            cur = new GridDistributedTxMapping(primary);
+            cur = new GridDistributedTxMapping(primary, cacheCtx.isNear());
 
             curMapping.put(key, cur);
 
@@ -571,9 +571,6 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
                     tx.colocatedLocallyMapped(true);
             }
 
-            // Initialize near flag right away.
-            cur.near(cacheCtx.isNear());
-
             cur.clientFirst(!topLocked && cctx.kernalContext().clientNode());
 
             cur.last(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7bd1ff15/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 bae0327..85c5948 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,10 +552,7 @@ 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);
-
-            // Initialize near flag right away.
-            cur.near(cacheCtx.isNear());
+            cur = new GridDistributedTxMapping(primary, cacheCtx.isNear());
 
             cur.clientFirst(clientFirst);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7bd1ff15/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index 9ee9aea..2ab4adf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -187,9 +187,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
             GridDistributedTxMapping nodeMapping = mappings.get(key);
 
             if (nodeMapping == null) {
-                nodeMapping = new GridDistributedTxMapping(primary);
-
-                nodeMapping.near(cacheCtx.isNear());
+                nodeMapping = new GridDistributedTxMapping(primary, cacheCtx.isNear());
 
                 mappings.put(key, nodeMapping);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7bd1ff15/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index aa4e929f..c74d157 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -23,7 +23,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.IgniteCheckedException;
@@ -589,9 +588,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
                 GridDistributedTxMapping m = mappings.get(n.id());
 
                 if (m == null) {
-                    mappings.put(m = new GridDistributedTxMapping(n));
-
-                    m.near(map.near());
+                    mappings.put(m = new GridDistributedTxMapping(n, map.near()));
 
                     if (map.explicitLock())
                         m.markExplicitLock();
@@ -614,12 +611,10 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     void addSingleEntryMapping(GridDistributedTxMapping map, IgniteTxEntry entry) {
         ClusterNode n = map.node();
 
-        GridDistributedTxMapping m = new GridDistributedTxMapping(n);
+        GridDistributedTxMapping m = new GridDistributedTxMapping(n, map.near());
 
         mappings.put(m);
 
-        m.near(map.near());
-
         if (map.explicitLock())
             m.markExplicitLock();
 


Mime
View raw message