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 2016/02/25 13:31:04 UTC

[05/51] [abbrv] ignite git commit: IGNITE-2532: WIP on single message optimization.

IGNITE-2532: WIP on single message optimization.


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

Branch: refs/heads/ignite-2523
Commit: 89c8074452b4bc209eb03d758e534f0ef8365d46
Parents: 52d20cd
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 12:08:18 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 12:08:18 2016 +0300

----------------------------------------------------------------------
 .../GridNearAtomicSingleUpdateRequest.java      | 81 ++++++++++----------
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 15 ++--
 2 files changed, 45 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/89c80744/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index cee662c..9ef0b6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -161,6 +161,11 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     /**
      * Constructor.
      *
+     * @param key Key.
+     * @param val Value.
+     * @param conflictTtl Conflict TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
      * @param cacheId Cache ID.
      * @param nodeId Node ID.
      * @param futVer Future version.
@@ -181,7 +186,13 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @param clientReq Client node request flag.
      * @param addDepInfo Deployment info flag.
      */
+    @SuppressWarnings("unchecked")
     public GridNearAtomicSingleUpdateRequest(
+        KeyCacheObject key,
+        @Nullable Object val,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
         int cacheId,
         UUID nodeId,
         GridCacheVersion futVer,
@@ -204,6 +215,8 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     ) {
         assert futVer != null;
 
+        this.key = key;
+
         this.cacheId = cacheId;
         this.nodeId = nodeId;
         this.futVer = futVer;
@@ -224,6 +237,32 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         this.keepBinary = keepBinary;
         this.clientReq = clientReq;
         this.addDepInfo = addDepInfo;
+
+        EntryProcessor<Object, Object, Object> entryProc = null;
+
+        if (op == TRANSFORM) {
+            assert val instanceof EntryProcessor : val;
+
+            entryProc = (EntryProcessor<Object, Object, Object>) val;
+        }
+
+        assert val != null || op == DELETE;
+
+        if (entryProc != null)
+            this.entryProc = entryProc;
+        else if (val != null) {
+            assert val instanceof CacheObject : val;
+
+            this.val = (CacheObject)val;
+        }
+
+        this.conflictVer = conflictVer;
+
+        if (conflictTtl >= 0)
+            this.conflictTtl = conflictTtl;
+
+        if (conflictExpireTime >= 0)
+            this.conflictExpireTime = conflictExpireTime;
     }
 
     /** {@inheritDoc} */
@@ -344,48 +383,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /**
-     * @param key Key to add.
-     * @param val Optional update value.
-     * @param conflictTtl Conflict TTL (optional).
-     * @param conflictExpireTime Conflict expire time (optional).
-     * @param conflictVer Conflict version (optional).
-     */
-    @SuppressWarnings("unchecked")
-    public void addUpdateEntry(KeyCacheObject key,
-        @Nullable Object val,
-        long conflictTtl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer) {
-        EntryProcessor<Object, Object, Object> entryProcessor = null;
-
-        if (op == TRANSFORM) {
-            assert val instanceof EntryProcessor : val;
-
-            entryProcessor = (EntryProcessor<Object, Object, Object>) val;
-        }
-
-        assert val != null || op == DELETE;
-
-        this.key = key;
-
-        if (entryProcessor != null)
-            this.entryProc = entryProcessor;
-        else if (val != null) {
-            assert val instanceof CacheObject : val;
-
-            this.val = (CacheObject)val;
-        }
-
-        this.conflictVer = conflictVer;
-
-        if (conflictTtl >= 0)
-            this.conflictTtl = conflictTtl;
-
-        if (conflictExpireTime >= 0)
-            this.conflictExpireTime = conflictExpireTime;
-    }
-
-    /**
      * @return Keys for this update request.
      */
     public List<KeyCacheObject> keys() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/89c80744/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 38e93ec..c8550f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -1009,7 +1009,12 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
         }
 
         if (optimize) {
-            GridNearAtomicSingleUpdateRequest req = new GridNearAtomicSingleUpdateRequest(
+            return new GridNearAtomicSingleUpdateRequest(
+                cacheKey,
+                val,
+                conflictTtl,
+                conflictExpireTime,
+                conflictVer,
                 cctx.cacheId(),
                 primary.id(),
                 futVer,
@@ -1029,14 +1034,6 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                 keepBinary,
                 cctx.kernalContext().clientNode(),
                 cctx.deploymentEnabled());
-
-            req.addUpdateEntry(cacheKey,
-                val,
-                conflictTtl,
-                conflictExpireTime,
-                conflictVer);
-
-            return req;
         }
         else {
             GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(