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:00 UTC

[01/51] [abbrv] ignite git commit: IGNITE-2532: WIP. Only refactorings for now.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2523 [created] 802456659


http://git-wip-us.apache.org/repos/asf/ignite/blob/29c2aee6/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 8b1673f..2aa510d 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
@@ -62,8 +62,8 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
 /**
  * DHT atomic cache near update future.
  */
-public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFuture
-    {
+@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFuture {
     /** Keys */
     private Collection<?> keys;
 
@@ -79,8 +79,39 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     private Collection<GridCacheVersion> conflictRmvVals;
 
-    /** State. */
-    private final UpdateState state;
+    /** Current topology version. */
+    private AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
+
+    /** */
+    private GridCacheVersion updVer;
+
+    /** Topology version when got mapping error. */
+    private AffinityTopologyVersion mapErrTopVer;
+
+    /** Mappings if operations is mapped to more than one node. */
+    @GridToStringInclude
+    private Map<UUID, GridNearAtomicUpdateRequest> mappings;
+
+    /** */
+    private int resCnt;
+
+    /** Error. */
+    private CachePartialUpdateCheckedException err;
+
+    /** Future ID. */
+    private GridCacheVersion futVer;
+
+    /** Completion future for a particular topology version. */
+    private GridFutureAdapter<Void> topCompleteFut;
+
+    /** Keys to remap. */
+    private Collection<KeyCacheObject> remapKeys;
+
+    /** Not null is operation is mapped to single node. */
+    private GridNearAtomicUpdateRequest singleReq;
+
+    /** Operation result. */
+    private GridCacheReturn opRes;    
 
     /**
      * @param cctx Cache context.
@@ -130,55 +161,22 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
         assert vals == null || vals.size() == keys.size();
         assert conflictPutVals == null || conflictPutVals.size() == keys.size();
         assert conflictRmvVals == null || conflictRmvVals.size() == keys.size();
-        assert subjId != null;
 
         this.keys = keys;
         this.vals = vals;
         this.conflictPutVals = conflictPutVals;
         this.conflictRmvVals = conflictRmvVals;
-
-        state = new UpdateState();
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion version() {
-        return state.futureVersion();
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<?> keys() {
-        return keys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onNodeLeft(UUID nodeId) {
-        state.onNodeLeft(nodeId);
-
-        return false;
-    }
-
-    /**
-     * Performs future mapping.
-     */
-    public void map() {
-        AffinityTopologyVersion topVer = cctx.shared().lockedTopologyVersion(null);
-
-        if (topVer == null)
-            mapOnTopology();
-        else {
-            topLocked = true;
-
-            // Cannot remap.
-            remapCnt = 1;
-
-            state.map(topVer, null);
-        }
+    @Override public synchronized GridCacheVersion version() {
+        return futVer;
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
         if (waitForPartitionExchange()) {
-            GridFutureAdapter<Void> fut = state.completeFuture(topVer);
+            GridFutureAdapter<Void> fut = completeFuture0(topVer);
 
             if (fut != null && isDone()) {
                 fut.onDone();
@@ -193,6 +191,39 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     }
 
     /** {@inheritDoc} */
+    @Override public boolean onNodeLeft(UUID nodeId) {
+        GridNearAtomicUpdateResponse res = null;
+
+        synchronized (this) {
+            GridNearAtomicUpdateRequest req;
+
+            if (singleReq != null)
+                req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
+            else
+                req = mappings != null ? mappings.get(nodeId) : null;
+
+            if (req != null && req.response() == null) {
+                res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                    nodeId,
+                    req.futureVersion(),
+                    cctx.deploymentEnabled());
+
+                ClusterTopologyCheckedException e = new ClusterTopologyCheckedException("Primary node left grid " +
+                    "before response is received: " + nodeId);
+
+                e.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(req.topologyVersion()));
+
+                res.addFailedKeys(req.keys(), e);
+            }
+        }
+
+        if (res != null)
+            onResult(nodeId, res, true);
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings("ConstantConditions")
     @Override public boolean onDone(@Nullable Object res, @Nullable Throwable err) {
         assert res == null || res instanceof GridCacheReturn;
@@ -207,7 +238,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             retval = Collections.emptyMap();
 
         if (super.onDone(retval, err)) {
-            GridCacheVersion futVer = state.onFutureDone();
+            GridCacheVersion futVer = onFutureDone();
 
             if (futVer != null)
                 cctx.mvcc().removeAtomicFuture(futVer);
@@ -219,13 +250,31 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     }
 
     /**
+     * Performs future mapping.
+     */
+    public void map() {
+        AffinityTopologyVersion topVer = cctx.shared().lockedTopologyVersion(null);
+
+        if (topVer == null)
+            mapOnTopology();
+        else {
+            topLocked = true;
+
+            // Cannot remap.
+            remapCnt = 1;
+
+            map(topVer, null);
+        }
+    }
+
+    /**
      * Response callback.
      *
      * @param nodeId Node ID.
      * @param res Update response.
      */
     public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
-        state.onResult(nodeId, res, false);
+        onResult(nodeId, res, false);
     }
 
     /**
@@ -281,7 +330,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             cache.topology().readUnlock();
         }
 
-        state.map(topVer, null);
+        map(topVer, null);
     }
 
     /**
@@ -310,7 +359,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                     onDone(new GridCacheReturn(cctx, true, true, null, true));
             }
             catch (IgniteCheckedException e) {
-                state.onSendError(req, e);
+                onSendError(req, e);
             }
         }
     }
@@ -341,7 +390,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                     cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
                 }
                 catch (IgniteCheckedException e) {
-                    state.onSendError(req, e);
+                    onSendError(req, e);
                 }
             }
         }
@@ -360,610 +409,422 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     }
 
     /**
-     *
+     * @param nodeId Node ID.
+     * @param res Response.
+     * @param nodeErr {@code True} if response was created on node failure.
      */
-    private class UpdateState {
-        /** Current topology version. */
-        private AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
-
-        /** */
-        private GridCacheVersion updVer;
-
-        /** Topology version when got mapping error. */
-        private AffinityTopologyVersion mapErrTopVer;
-
-        /** Mappings if operations is mapped to more than one node. */
-        @GridToStringInclude
-        private Map<UUID, GridNearAtomicUpdateRequest> mappings;
-
-        /** */
-        private int resCnt;
-
-        /** Error. */
-        private CachePartialUpdateCheckedException err;
+    @SuppressWarnings("unchecked")
+    void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
+        GridNearAtomicUpdateRequest req;
 
-        /** Future ID. */
-        private GridCacheVersion futVer;
+        AffinityTopologyVersion remapTopVer = null;
 
-        /** Completion future for a particular topology version. */
-        private GridFutureAdapter<Void> topCompleteFut;
+        GridCacheReturn opRes0 = null;
+        CachePartialUpdateCheckedException err0 = null;
 
-        /** Keys to remap. */
-        private Collection<KeyCacheObject> remapKeys;
+        boolean rcvAll;
 
-        /** Not null is operation is mapped to single node. */
-        private GridNearAtomicUpdateRequest singleReq;
+        GridFutureAdapter<?> fut0 = null;
 
-        /** Operation result. */
-        private GridCacheReturn opRes;
-
-        /**
-         * @return Future version.
-         */
-        @Nullable synchronized GridCacheVersion futureVersion() {
-            return futVer;
-        }
-
-        /**
-         * @param nodeId Left node ID.
-         */
-        void onNodeLeft(UUID nodeId) {
-            GridNearAtomicUpdateResponse res = null;
-
-            synchronized (this) {
-                GridNearAtomicUpdateRequest req;
-
-                if (singleReq != null)
-                    req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
-                else
-                    req = mappings != null ? mappings.get(nodeId) : null;
+        synchronized (this) {
+            if (!res.futureVersion().equals(futVer))
+                return;
 
-                if (req != null && req.response() == null) {
-                    res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
-                        nodeId,
-                        req.futureVersion(),
-                        cctx.deploymentEnabled());
+            if (singleReq != null) {
+                if (!singleReq.nodeId().equals(nodeId))
+                    return;
 
-                    ClusterTopologyCheckedException e = new ClusterTopologyCheckedException("Primary node left grid " +
-                        "before response is received: " + nodeId);
+                req = singleReq;
 
-                    e.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(req.topologyVersion()));
+                singleReq = null;
 
-                    res.addFailedKeys(req.keys(), e);
-                }
+                rcvAll = true;
             }
+            else {
+                req = mappings != null ? mappings.get(nodeId) : null;
 
-            if (res != null)
-                onResult(nodeId, res, true);
-        }
-
-        /**
-         * @param nodeId Node ID.
-         * @param res Response.
-         * @param nodeErr {@code True} if response was created on node failure.
-         */
-        @SuppressWarnings("unchecked")
-        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
-            GridNearAtomicUpdateRequest req;
-
-            AffinityTopologyVersion remapTopVer = null;
-
-            GridCacheReturn opRes0 = null;
-            CachePartialUpdateCheckedException err0 = null;
-
-            boolean rcvAll;
-
-            GridFutureAdapter<?> fut0 = null;
+                if (req != null && req.onResponse(res)) {
+                    resCnt++;
 
-            synchronized (this) {
-                if (!res.futureVersion().equals(futVer))
+                    rcvAll = mappings.size() == resCnt;
+                }
+                else
                     return;
+            }
 
-                if (singleReq != null) {
-                    if (!singleReq.nodeId().equals(nodeId))
-                        return;
+            assert req != null && req.topologyVersion().equals(topVer) : req;
 
-                    req = singleReq;
+            if (res.remapKeys() != null) {
+                assert !fastMap || cctx.kernalContext().clientNode();
 
-                    singleReq = null;
+                if (remapKeys == null)
+                    remapKeys = U.newHashSet(res.remapKeys().size());
 
-                    rcvAll = true;
-                }
-                else {
-                    req = mappings != null ? mappings.get(nodeId) : null;
+                remapKeys.addAll(res.remapKeys());
 
-                    if (req != null && req.onResponse(res)) {
-                        resCnt++;
+                if (mapErrTopVer == null || mapErrTopVer.compareTo(req.topologyVersion()) < 0)
+                    mapErrTopVer = req.topologyVersion();
+            }
+            else if (res.error() != null) {
+                if (res.failedKeys() != null)
+                    addFailedKeys(res.failedKeys(), req.topologyVersion(), res.error());
+            }
+            else {
+                if (!req.fastMap() || req.hasPrimary()) {
+                    GridCacheReturn ret = res.returnValue();
 
-                        rcvAll = mappings.size() == resCnt;
+                    if (op == TRANSFORM) {
+                        if (ret != null)
+                            addInvokeResults(ret);
                     }
                     else
-                        return;
+                        opRes = ret;
                 }
+            }
 
-                assert req != null && req.topologyVersion().equals(topVer) : req;
-
-                if (res.remapKeys() != null) {
-                    assert !fastMap || cctx.kernalContext().clientNode();
-
-                    if (remapKeys == null)
-                        remapKeys = U.newHashSet(res.remapKeys().size());
-
-                    remapKeys.addAll(res.remapKeys());
+            if (rcvAll) {
+                if (remapKeys != null) {
+                    assert mapErrTopVer != null;
 
-                    if (mapErrTopVer == null || mapErrTopVer.compareTo(req.topologyVersion()) < 0)
-                        mapErrTopVer = req.topologyVersion();
-                }
-                else if (res.error() != null) {
-                    if (res.failedKeys() != null)
-                        addFailedKeys(res.failedKeys(), req.topologyVersion(), res.error());
+                    remapTopVer = new AffinityTopologyVersion(mapErrTopVer.topologyVersion() + 1);
                 }
                 else {
-                    if (!req.fastMap() || req.hasPrimary()) {
-                        GridCacheReturn ret = res.returnValue();
-
-                        if (op == TRANSFORM) {
-                            if (ret != null)
-                                addInvokeResults(ret);
-                        }
-                        else
-                            opRes = ret;
-                    }
-                }
-
-                if (rcvAll) {
-                    if (remapKeys != null) {
-                        assert mapErrTopVer != null;
+                    if (err != null &&
+                        X.hasCause(err, CachePartialUpdateCheckedException.class) &&
+                        X.hasCause(err, ClusterTopologyCheckedException.class) &&
+                        storeFuture() &&
+                        --remapCnt > 0) {
+                        ClusterTopologyCheckedException topErr =
+                            X.cause(err, ClusterTopologyCheckedException.class);
 
-                        remapTopVer = new AffinityTopologyVersion(mapErrTopVer.topologyVersion() + 1);
-                    }
-                    else {
-                        if (err != null &&
-                            X.hasCause(err, CachePartialUpdateCheckedException.class) &&
-                            X.hasCause(err, ClusterTopologyCheckedException.class) &&
-                            storeFuture() &&
-                            --remapCnt > 0) {
-                            ClusterTopologyCheckedException topErr =
-                                X.cause(err, ClusterTopologyCheckedException.class);
+                        if (!(topErr instanceof ClusterTopologyServerNotFoundException)) {
+                            CachePartialUpdateCheckedException cause =
+                                X.cause(err, CachePartialUpdateCheckedException.class);
 
-                            if (!(topErr instanceof ClusterTopologyServerNotFoundException)) {
-                                CachePartialUpdateCheckedException cause =
-                                    X.cause(err, CachePartialUpdateCheckedException.class);
+                            assert cause != null && cause.topologyVersion() != null : err;
 
-                                assert cause != null && cause.topologyVersion() != null : err;
+                            remapTopVer =
+                                new AffinityTopologyVersion(cause.topologyVersion().topologyVersion() + 1);
 
-                                remapTopVer =
-                                    new AffinityTopologyVersion(cause.topologyVersion().topologyVersion() + 1);
+                            err = null;
 
-                                err = null;
+                            Collection<Object> failedKeys = cause.failedKeys();
 
-                                Collection<Object> failedKeys = cause.failedKeys();
+                            remapKeys = new ArrayList<>(failedKeys.size());
 
-                                remapKeys = new ArrayList<>(failedKeys.size());
+                            for (Object key : failedKeys)
+                                remapKeys.add(cctx.toCacheKeyObject(key));
 
-                                for (Object key : failedKeys)
-                                    remapKeys.add(cctx.toCacheKeyObject(key));
-
-                                updVer = null;
-                            }
+                            updVer = null;
                         }
                     }
+                }
 
-                    if (remapTopVer == null) {
-                        err0 = err;
-                        opRes0 = opRes;
-                    }
-                    else {
-                        fut0 = topCompleteFut;
+                if (remapTopVer == null) {
+                    err0 = err;
+                    opRes0 = opRes;
+                }
+                else {
+                    fut0 = topCompleteFut;
 
-                        topCompleteFut = null;
+                    topCompleteFut = null;
 
-                        cctx.mvcc().removeAtomicFuture(futVer);
+                    cctx.mvcc().removeAtomicFuture(futVer);
 
-                        futVer = null;
-                        topVer = AffinityTopologyVersion.ZERO;
-                    }
+                    futVer = null;
+                    topVer = AffinityTopologyVersion.ZERO;
                 }
             }
+        }
 
-            if (res.error() != null && res.failedKeys() == null) {
-                onDone(res.error());
+        if (res.error() != null && res.failedKeys() == null) {
+            onDone(res.error());
 
-                return;
-            }
+            return;
+        }
 
-            if (rcvAll && nearEnabled) {
-                if (mappings != null) {
-                    for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
-                        GridNearAtomicUpdateResponse res0 = req0.response();
+        if (rcvAll && nearEnabled) {
+            if (mappings != null) {
+                for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+                    GridNearAtomicUpdateResponse res0 = req0.response();
 
-                        assert res0 != null : req0;
+                    assert res0 != null : req0;
 
-                        updateNear(req0, res0);
-                    }
+                    updateNear(req0, res0);
                 }
-                else if (!nodeErr)
-                    updateNear(req, res);
             }
+            else if (!nodeErr)
+                updateNear(req, res);
+        }
 
-            if (remapTopVer != null) {
-                if (fut0 != null)
-                    fut0.onDone();
+        if (remapTopVer != null) {
+            if (fut0 != null)
+                fut0.onDone();
 
-                if (!waitTopFut) {
-                    onDone(new GridCacheTryPutFailedException());
+            if (!waitTopFut) {
+                onDone(new GridCacheTryPutFailedException());
 
-                    return;
-                }
+                return;
+            }
 
-                if (topLocked) {
-                    assert !F.isEmpty(remapKeys) : remapKeys;
+            if (topLocked) {
+                assert !F.isEmpty(remapKeys) : remapKeys;
 
-                    CachePartialUpdateCheckedException e =
-                        new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
+                CachePartialUpdateCheckedException e =
+                    new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
 
-                    ClusterTopologyCheckedException cause = new ClusterTopologyCheckedException(
-                        "Failed to update keys, topology changed while execute atomic update inside transaction.");
+                ClusterTopologyCheckedException cause = new ClusterTopologyCheckedException(
+                    "Failed to update keys, topology changed while execute atomic update inside transaction.");
 
-                    cause.retryReadyFuture(cctx.affinity().affinityReadyFuture(remapTopVer));
+                cause.retryReadyFuture(cctx.affinity().affinityReadyFuture(remapTopVer));
 
-                    e.add(remapKeys, cause);
+                e.add(remapKeys, cause);
 
-                    onDone(e);
+                onDone(e);
 
-                    return;
-                }
+                return;
+            }
 
-                IgniteInternalFuture<AffinityTopologyVersion> fut =
-                    cctx.shared().exchange().affinityReadyFuture(remapTopVer);
+            IgniteInternalFuture<AffinityTopologyVersion> fut =
+                cctx.shared().exchange().affinityReadyFuture(remapTopVer);
 
-                if (fut == null)
-                    fut = new GridFinishedFuture<>(remapTopVer);
+            if (fut == null)
+                fut = new GridFinishedFuture<>(remapTopVer);
 
-                fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
-                    @Override public void apply(final IgniteInternalFuture<AffinityTopologyVersion> fut) {
-                        cctx.kernalContext().closure().runLocalSafe(new Runnable() {
-                            @Override public void run() {
-                                try {
-                                    AffinityTopologyVersion topVer = fut.get();
+            fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
+                @Override public void apply(final IgniteInternalFuture<AffinityTopologyVersion> fut) {
+                    cctx.kernalContext().closure().runLocalSafe(new Runnable() {
+                        @Override public void run() {
+                            try {
+                                AffinityTopologyVersion topVer = fut.get();
 
-                                    map(topVer, remapKeys);
-                                }
-                                catch (IgniteCheckedException e) {
-                                    onDone(e);
-                                }
+                                map(topVer, remapKeys);
                             }
-                        });
-                    }
-                });
-
-                return;
-            }
+                            catch (IgniteCheckedException e) {
+                                onDone(e);
+                            }
+                        }
+                    });
+                }
+            });
 
-            if (rcvAll)
-                onDone(opRes0, err0);
+            return;
         }
 
-        /**
-         * @param req Request.
-         * @param e Error.
-         */
-        void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
-            synchronized (this) {
-                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
-                    req.nodeId(),
-                    req.futureVersion(),
-                    cctx.deploymentEnabled());
+        if (rcvAll)
+            onDone(opRes0, err0);
+    }
 
-                res.addFailedKeys(req.keys(), e);
+    /**
+     * @param req Request.
+     * @param e Error.
+     */
+    void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
+        synchronized (this) {
+            GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                req.nodeId(),
+                req.futureVersion(),
+                cctx.deploymentEnabled());
 
-                onResult(req.nodeId(), res, true);
-            }
+            res.addFailedKeys(req.keys(), e);
+
+            onResult(req.nodeId(), res, true);
         }
+    }
 
-        /**
-         * @param topVer Topology version.
-         * @param remapKeys Keys to remap.
-         */
-        void map(AffinityTopologyVersion topVer, @Nullable Collection<KeyCacheObject> remapKeys) {
-            Collection<ClusterNode> topNodes = CU.affinityNodes(cctx, topVer);
+    /**
+     * @param topVer Topology version.
+     * @param remapKeys Keys to remap.
+     */
+    void map(AffinityTopologyVersion topVer, @Nullable Collection<KeyCacheObject> remapKeys) {
+        Collection<ClusterNode> topNodes = CU.affinityNodes(cctx, topVer);
 
-            if (F.isEmpty(topNodes)) {
-                onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
-                    "left the grid)."));
+        if (F.isEmpty(topNodes)) {
+            onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
+                "left the grid)."));
 
-                return;
-            }
+            return;
+        }
 
-            Exception err = null;
-            GridNearAtomicUpdateRequest singleReq0 = null;
-            Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
+        Exception err = null;
+        GridNearAtomicUpdateRequest singleReq0 = null;
+        Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
 
-            int size = keys.size();
+        int size = keys.size();
 
-            GridCacheVersion futVer = cctx.versions().next(topVer);
+        GridCacheVersion futVer = cctx.versions().next(topVer);
 
-            GridCacheVersion updVer;
+        GridCacheVersion updVer;
 
-            // Assign version on near node in CLOCK ordering mode even if fastMap is false.
-            if (cctx.config().getAtomicWriteOrderMode() == CLOCK) {
-                updVer = this.updVer;
+        // Assign version on near node in CLOCK ordering mode even if fastMap is false.
+        if (cctx.config().getAtomicWriteOrderMode() == CLOCK) {
+            updVer = this.updVer;
 
-                if (updVer == null) {
-                    updVer = cctx.versions().next(topVer);
+            if (updVer == null) {
+                updVer = cctx.versions().next(topVer);
 
-                    if (log.isDebugEnabled())
-                        log.debug("Assigned fast-map version for update on near node: " + updVer);
-                }
+                if (log.isDebugEnabled())
+                    log.debug("Assigned fast-map version for update on near node: " + updVer);
             }
-            else
-                updVer = null;
+        }
+        else
+            updVer = null;
 
-            try {
-                if (size == 1 && !fastMap) {
-                    assert remapKeys == null || remapKeys.size() == 1;
+        try {
+            if (size == 1 && !fastMap) {
+                assert remapKeys == null || remapKeys.size() == 1;
 
-                    singleReq0 = mapSingleUpdate(topVer, futVer, updVer);
-                }
+                singleReq0 = mapSingleUpdate(topVer, futVer, updVer);
+            }
+            else {
+                Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
+                    topVer,
+                    futVer,
+                    updVer,
+                    remapKeys);
+
+                if (pendingMappings.size() == 1)
+                    singleReq0 = F.firstValue(pendingMappings);
                 else {
-                    Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
-                        topVer,
-                        futVer,
-                        updVer,
-                        remapKeys);
+                    if (syncMode == PRIMARY_SYNC) {
+                        mappings0 = U.newHashMap(pendingMappings.size());
 
-                    if (pendingMappings.size() == 1)
-                        singleReq0 = F.firstValue(pendingMappings);
-                    else {
-                        if (syncMode == PRIMARY_SYNC) {
-                            mappings0 = U.newHashMap(pendingMappings.size());
-
-                            for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
-                                if (req.hasPrimary())
-                                    mappings0.put(req.nodeId(), req);
-                            }
+                        for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
+                            if (req.hasPrimary())
+                                mappings0.put(req.nodeId(), req);
                         }
-                        else
-                            mappings0 = pendingMappings;
-
-                        assert !mappings0.isEmpty() || size == 0 : GridNearAtomicUpdateFuture.this;
                     }
+                    else
+                        mappings0 = pendingMappings;
+
+                    assert !mappings0.isEmpty() || size == 0 : this;
                 }
+            }
 
-                synchronized (this) {
-                    assert this.futVer == null : this;
-                    assert this.topVer == AffinityTopologyVersion.ZERO : this;
+            synchronized (this) {
+                assert this.futVer == null : this;
+                assert this.topVer == AffinityTopologyVersion.ZERO : this;
 
-                    this.topVer = topVer;
-                    this.updVer = updVer;
-                    this.futVer = futVer;
+                this.topVer = topVer;
+                this.updVer = updVer;
+                this.futVer = futVer;
 
-                    resCnt = 0;
+                resCnt = 0;
 
-                    singleReq = singleReq0;
-                    mappings = mappings0;
+                singleReq = singleReq0;
+                mappings = mappings0;
 
-                    this.remapKeys = null;
-                }
-            }
-            catch (Exception e) {
-                err = e;
+                this.remapKeys = null;
             }
+        }
+        catch (Exception e) {
+            err = e;
+        }
 
-            if (err != null) {
-                onDone(err);
+        if (err != null) {
+            onDone(err);
 
-                return;
-            }
+            return;
+        }
 
-            if (storeFuture()) {
-                if (!cctx.mvcc().addAtomicFuture(futVer, GridNearAtomicUpdateFuture.this)) {
-                    assert isDone() : GridNearAtomicUpdateFuture.this;
+        if (storeFuture()) {
+            if (!cctx.mvcc().addAtomicFuture(futVer, this)) {
+                assert isDone() : this;
 
-                    return;
-                }
+                return;
             }
+        }
 
-            // Optimize mapping for single key.
-            if (singleReq0 != null)
-                mapSingle(singleReq0.nodeId(), singleReq0);
-            else {
-                assert mappings0 != null;
+        // Optimize mapping for single key.
+        if (singleReq0 != null)
+            mapSingle(singleReq0.nodeId(), singleReq0);
+        else {
+            assert mappings0 != null;
 
-                if (size == 0)
-                    onDone(new GridCacheReturn(cctx, true, true, null, true));
-                else
-                    doUpdate(mappings0);
-            }
+            if (size == 0)
+                onDone(new GridCacheReturn(cctx, true, true, null, true));
+            else
+                doUpdate(mappings0);
         }
+    }
 
-        /**
-         * @param topVer Topology version.
-         * @return Future.
-         */
-        @Nullable synchronized GridFutureAdapter<Void> completeFuture(AffinityTopologyVersion topVer) {
-            if (this.topVer == AffinityTopologyVersion.ZERO)
-                return null;
-
-            if (this.topVer.compareTo(topVer) < 0) {
-                if (topCompleteFut == null)
-                    topCompleteFut = new GridFutureAdapter<>();
+    /**
+     * @param topVer Topology version.
+     * @return Future.
+     */
+    @Nullable private synchronized GridFutureAdapter<Void> completeFuture0(AffinityTopologyVersion topVer) {
+        if (this.topVer == AffinityTopologyVersion.ZERO)
+            return null;
 
-                return topCompleteFut;
-            }
+        if (this.topVer.compareTo(topVer) < 0) {
+            if (topCompleteFut == null)
+                topCompleteFut = new GridFutureAdapter<>();
 
-            return null;
+            return topCompleteFut;
         }
 
-        /**
-         * @return Future version.
-         */
-        GridCacheVersion onFutureDone() {
-            GridCacheVersion ver0;
-
-            GridFutureAdapter<Void> fut0;
+        return null;
+    }
 
-            synchronized (this) {
-                fut0 = topCompleteFut;
+    /**
+     * @return Future version.
+     */
+    private GridCacheVersion onFutureDone() {
+        GridCacheVersion ver0;
 
-                topCompleteFut = null;
+        GridFutureAdapter<Void> fut0;
 
-                ver0 = futVer;
+        synchronized (this) {
+            fut0 = topCompleteFut;
 
-                futVer = null;
-            }
+            topCompleteFut = null;
 
-            if (fut0 != null)
-                fut0.onDone();
+            ver0 = futVer;
 
-            return ver0;
+            futVer = null;
         }
 
-        /**
-         * @param topNodes Cache nodes.
-         * @param topVer Topology version.
-         * @param futVer Future version.
-         * @param updVer Update version.
-         * @param remapKeys Keys to remap.
-         * @return Mapping.
-         * @throws Exception If failed.
-         */
-        private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
-            AffinityTopologyVersion topVer,
-            GridCacheVersion futVer,
-            @Nullable GridCacheVersion updVer,
-            @Nullable Collection<KeyCacheObject> remapKeys) throws Exception {
-            Iterator<?> it = null;
-
-            if (vals != null)
-                it = vals.iterator();
-
-            Iterator<GridCacheDrInfo> conflictPutValsIt = null;
-
-            if (conflictPutVals != null)
-                conflictPutValsIt = conflictPutVals.iterator();
-
-            Iterator<GridCacheVersion> conflictRmvValsIt = null;
-
-            if (conflictRmvVals != null)
-                conflictRmvValsIt = conflictRmvVals.iterator();
-
-            Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
-
-            // Create mappings first, then send messages.
-            for (Object key : keys) {
-                if (key == null)
-                    throw new NullPointerException("Null key.");
-
-                Object val;
-                GridCacheVersion conflictVer;
-                long conflictTtl;
-                long conflictExpireTime;
-
-                if (vals != null) {
-                    val = it.next();
-                    conflictVer = null;
-                    conflictTtl = CU.TTL_NOT_CHANGED;
-                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-
-                    if (val == null)
-                        throw new NullPointerException("Null value.");
-                }
-                else if (conflictPutVals != null) {
-                    GridCacheDrInfo conflictPutVal = conflictPutValsIt.next();
-
-                    val = conflictPutVal.valueEx();
-                    conflictVer = conflictPutVal.version();
-                    conflictTtl =  conflictPutVal.ttl();
-                    conflictExpireTime = conflictPutVal.expireTime();
-                }
-                else if (conflictRmvVals != null) {
-                    val = null;
-                    conflictVer = conflictRmvValsIt.next();
-                    conflictTtl = CU.TTL_NOT_CHANGED;
-                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-                }
-                else {
-                    val = null;
-                    conflictVer = null;
-                    conflictTtl = CU.TTL_NOT_CHANGED;
-                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-                }
-
-                if (val == null && op != GridCacheOperation.DELETE)
-                    continue;
-
-                KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
+        if (fut0 != null)
+            fut0.onDone();
 
-                if (remapKeys != null && !remapKeys.contains(cacheKey))
-                    continue;
+        return ver0;
+    }
 
-                if (op != TRANSFORM)
-                    val = cctx.toCacheObject(val);
+    /**
+     * @param topNodes Cache nodes.
+     * @param topVer Topology version.
+     * @param futVer Future version.
+     * @param updVer Update version.
+     * @param remapKeys Keys to remap.
+     * @return Mapping.
+     * @throws Exception If failed.
+     */
+    private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+        AffinityTopologyVersion topVer,
+        GridCacheVersion futVer,
+        @Nullable GridCacheVersion updVer,
+        @Nullable Collection<KeyCacheObject> remapKeys) throws Exception {
+        Iterator<?> it = null;
 
-                Collection<ClusterNode> affNodes = mapKey(cacheKey, topVer, fastMap);
+        if (vals != null)
+            it = vals.iterator();
 
-                if (affNodes.isEmpty())
-                    throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                        "(all partition nodes left the grid).");
+        Iterator<GridCacheDrInfo> conflictPutValsIt = null;
 
-                int i = 0;
-
-                for (ClusterNode affNode : affNodes) {
-                    if (affNode == null)
-                        throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                            "(all partition nodes left the grid).");
-
-                    UUID nodeId = affNode.id();
-
-                    GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
-
-                    if (mapped == null) {
-                        mapped = new GridNearAtomicUpdateRequest(
-                            cctx.cacheId(),
-                            nodeId,
-                            futVer,
-                            fastMap,
-                            updVer,
-                            topVer,
-                            topLocked,
-                            syncMode,
-                            op,
-                            retval,
-                            expiryPlc,
-                            invokeArgs,
-                            filter,
-                            subjId,
-                            taskNameHash,
-                            skipStore,
-                            keepBinary,
-                            cctx.kernalContext().clientNode(),
-                            cctx.deploymentEnabled(),
-                            keys.size());
-
-                        pendingMappings.put(nodeId, mapped);
-                    }
+        if (conflictPutVals != null)
+            conflictPutValsIt = conflictPutVals.iterator();
 
-                    mapped.addUpdateEntry(cacheKey, val, conflictTtl, conflictExpireTime, conflictVer, i == 0);
+        Iterator<GridCacheVersion> conflictRmvValsIt = null;
 
-                    i++;
-                }
-            }
+        if (conflictRmvVals != null)
+            conflictRmvValsIt = conflictRmvVals.iterator();
 
-            return pendingMappings;
-        }
+        Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
 
-        /**
-         * @param topVer Topology version.
-         * @param futVer Future version.
-         * @param updVer Update version.
-         * @return Request.
-         * @throws Exception If failed.
-         */
-        private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
-            GridCacheVersion futVer,
-            @Nullable GridCacheVersion updVer) throws Exception {
-            Object key = F.first(keys);
+        // Create mappings first, then send messages.
+        for (Object key : keys) {
+            if (key == null)
+                throw new NullPointerException("Null key.");
 
             Object val;
             GridCacheVersion conflictVer;
@@ -971,127 +832,231 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             long conflictExpireTime;
 
             if (vals != null) {
-                // Regular PUT.
-                val = F.first(vals);
+                val = it.next();
                 conflictVer = null;
                 conflictTtl = CU.TTL_NOT_CHANGED;
                 conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+
+                if (val == null)
+                    throw new NullPointerException("Null value.");
             }
             else if (conflictPutVals != null) {
-                // Conflict PUT.
-                GridCacheDrInfo conflictPutVal = F.first(conflictPutVals);
+                GridCacheDrInfo conflictPutVal = conflictPutValsIt.next();
 
                 val = conflictPutVal.valueEx();
                 conflictVer = conflictPutVal.version();
-                conflictTtl = conflictPutVal.ttl();
+                conflictTtl =  conflictPutVal.ttl();
                 conflictExpireTime = conflictPutVal.expireTime();
             }
             else if (conflictRmvVals != null) {
-                // Conflict REMOVE.
                 val = null;
-                conflictVer = F.first(conflictRmvVals);
+                conflictVer = conflictRmvValsIt.next();
                 conflictTtl = CU.TTL_NOT_CHANGED;
                 conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
             }
             else {
-                // Regular REMOVE.
                 val = null;
                 conflictVer = null;
                 conflictTtl = CU.TTL_NOT_CHANGED;
                 conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
             }
 
-            // We still can get here if user pass map with single element.
-            if (key == null)
-                throw new NullPointerException("Null key.");
-
             if (val == null && op != GridCacheOperation.DELETE)
-                throw new NullPointerException("Null value.");
+                continue;
 
             KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
 
+            if (remapKeys != null && !remapKeys.contains(cacheKey))
+                continue;
+
             if (op != TRANSFORM)
                 val = cctx.toCacheObject(val);
 
-            ClusterNode primary = cctx.affinity().primary(cacheKey, topVer);
-
-            if (primary == null)
-                throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
-                    "left the grid).");
-
-            GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
-                cctx.cacheId(),
-                primary.id(),
-                futVer,
-                fastMap,
-                updVer,
-                topVer,
-                topLocked,
-                syncMode,
-                op,
-                retval,
-                expiryPlc,
-                invokeArgs,
-                filter,
-                subjId,
-                taskNameHash,
-                skipStore,
-                keepBinary,
-                cctx.kernalContext().clientNode(),
-                cctx.deploymentEnabled(),
-                1);
-
-            req.addUpdateEntry(cacheKey,
-                val,
-                conflictTtl,
-                conflictExpireTime,
-                conflictVer,
-                true);
-
-            return req;
-        }
+            Collection<ClusterNode> affNodes = mapKey(cacheKey, topVer, fastMap);
 
-        /**
-         * @param ret Result from single node.
-         */
-        @SuppressWarnings("unchecked")
-        private void addInvokeResults(GridCacheReturn ret) {
-            assert op == TRANSFORM : op;
-            assert ret.value() == null || ret.value() instanceof Map : ret.value();
-
-            if (ret.value() != null) {
-                if (opRes != null)
-                    opRes.mergeEntryProcessResults(ret);
-                else
-                    opRes = ret;
-            }
-        }
+            if (affNodes.isEmpty())
+                throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
+                    "(all partition nodes left the grid).");
+
+            int i = 0;
 
-        /**
-         * @param failedKeys Failed keys.
-         * @param topVer Topology version for failed update.
-         * @param err Error cause.
-         */
-        private void addFailedKeys(Collection<KeyCacheObject> failedKeys,
-            AffinityTopologyVersion topVer,
-            Throwable err) {
-            CachePartialUpdateCheckedException err0 = this.err;
+            for (ClusterNode affNode : affNodes) {
+                if (affNode == null)
+                    throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
+                        "(all partition nodes left the grid).");
 
-            if (err0 == null)
-                err0 = this.err = new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
+                UUID nodeId = affNode.id();
 
-            Collection<Object> keys = new ArrayList<>(failedKeys.size());
+                GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
+
+                if (mapped == null) {
+                    mapped = new GridNearAtomicUpdateRequest(
+                        cctx.cacheId(),
+                        nodeId,
+                        futVer,
+                        fastMap,
+                        updVer,
+                        topVer,
+                        topLocked,
+                        syncMode,
+                        op,
+                        retval,
+                        expiryPlc,
+                        invokeArgs,
+                        filter,
+                        subjId,
+                        taskNameHash,
+                        skipStore,
+                        keepBinary,
+                        cctx.kernalContext().clientNode(),
+                        cctx.deploymentEnabled(),
+                        keys.size());
+
+                    pendingMappings.put(nodeId, mapped);
+                }
 
-            for (KeyCacheObject key : failedKeys)
-                keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
+                mapped.addUpdateEntry(cacheKey, val, conflictTtl, conflictExpireTime, conflictVer, i == 0);
 
-            err0.add(keys, err, topVer);
+                i++;
+            }
         }
 
-        /** {@inheritDoc} */
-        @Override public synchronized  String toString() {
-            return S.toString(UpdateState.class, this);
+        return pendingMappings;
+    }
+
+    /**
+     * @param topVer Topology version.
+     * @param futVer Future version.
+     * @param updVer Update version.
+     * @return Request.
+     * @throws Exception If failed.
+     */
+    private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
+        GridCacheVersion futVer,
+        @Nullable GridCacheVersion updVer) throws Exception {
+        Object key = F.first(keys);
+
+        Object val;
+        GridCacheVersion conflictVer;
+        long conflictTtl;
+        long conflictExpireTime;
+
+        if (vals != null) {
+            // Regular PUT.
+            val = F.first(vals);
+            conflictVer = null;
+            conflictTtl = CU.TTL_NOT_CHANGED;
+            conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+        }
+        else if (conflictPutVals != null) {
+            // Conflict PUT.
+            GridCacheDrInfo conflictPutVal = F.first(conflictPutVals);
+
+            val = conflictPutVal.valueEx();
+            conflictVer = conflictPutVal.version();
+            conflictTtl = conflictPutVal.ttl();
+            conflictExpireTime = conflictPutVal.expireTime();
+        }
+        else if (conflictRmvVals != null) {
+            // Conflict REMOVE.
+            val = null;
+            conflictVer = F.first(conflictRmvVals);
+            conflictTtl = CU.TTL_NOT_CHANGED;
+            conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
         }
+        else {
+            // Regular REMOVE.
+            val = null;
+            conflictVer = null;
+            conflictTtl = CU.TTL_NOT_CHANGED;
+            conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+        }
+
+        // We still can get here if user pass map with single element.
+        if (key == null)
+            throw new NullPointerException("Null key.");
+
+        if (val == null && op != GridCacheOperation.DELETE)
+            throw new NullPointerException("Null value.");
+
+        KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
+
+        if (op != TRANSFORM)
+            val = cctx.toCacheObject(val);
+
+        ClusterNode primary = cctx.affinity().primary(cacheKey, topVer);
+
+        if (primary == null)
+            throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
+                "left the grid).");
+
+        GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+            cctx.cacheId(),
+            primary.id(),
+            futVer,
+            fastMap,
+            updVer,
+            topVer,
+            topLocked,
+            syncMode,
+            op,
+            retval,
+            expiryPlc,
+            invokeArgs,
+            filter,
+            subjId,
+            taskNameHash,
+            skipStore,
+            keepBinary,
+            cctx.kernalContext().clientNode(),
+            cctx.deploymentEnabled(),
+            1);
+
+        req.addUpdateEntry(cacheKey,
+            val,
+            conflictTtl,
+            conflictExpireTime,
+            conflictVer,
+            true);
+
+        return req;
+    }
+
+    /**
+     * @param ret Result from single node.
+     */
+    @SuppressWarnings("unchecked")
+    private void addInvokeResults(GridCacheReturn ret) {
+        assert op == TRANSFORM : op;
+        assert ret.value() == null || ret.value() instanceof Map : ret.value();
+
+        if (ret.value() != null) {
+            if (opRes != null)
+                opRes.mergeEntryProcessResults(ret);
+            else
+                opRes = ret;
+        }
+    }
+
+    /**
+     * @param failedKeys Failed keys.
+     * @param topVer Topology version for failed update.
+     * @param err Error cause.
+     */
+    private void addFailedKeys(Collection<KeyCacheObject> failedKeys,
+        AffinityTopologyVersion topVer,
+        Throwable err) {
+        CachePartialUpdateCheckedException err0 = this.err;
+
+        if (err0 == null)
+            err0 = this.err = new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
+
+        Collection<Object> keys = new ArrayList<>(failedKeys.size());
+
+        for (KeyCacheObject key : failedKeys)
+            keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
+
+        err0.add(keys, err, topVer);
     }
 
     /** {@inheritDoc} */


[34/51] [abbrv] ignite git commit: Fixed failing tests.

Posted by vo...@apache.org.
Fixed failing tests.


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

Branch: refs/heads/ignite-2523
Commit: 20bbd6132d0b08bf97b8bea41b8493172361c7d5
Parents: 072ba10
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Feb 20 15:44:59 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Feb 20 15:44:59 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          |  8 +--
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  8 ++-
 .../resources/META-INF/classnames.properties    | 12 ++--
 .../IgniteClientReconnectAbstractTest.java      |  2 +-
 .../IgniteClientReconnectCacheTest.java         | 73 ++++++++++++++------
 .../IgniteClientReconnectCollectionsTest.java   |  3 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |  5 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |  3 +-
 ...ContinuousQueryFailoverAbstractSelfTest.java |  5 +-
 9 files changed, 81 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 4faf91a..d1423f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1451,7 +1451,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             UpdateBatchResult updRes = updateWithBatch(node,
                                 hasNear,
                                 req,
-                                (GridNearAtomicMultipleUpdateResponse)res,
+                                res,
                                 locked,
                                 ver,
                                 dhtFut,
@@ -1589,7 +1589,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         ClusterNode node,
         boolean hasNear,
         GridNearAtomicUpdateRequest req,
-        GridNearAtomicMultipleUpdateResponse res,
+        GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
@@ -2268,7 +2268,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
         CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         final GridNearAtomicUpdateRequest req,
-        final GridNearAtomicMultipleUpdateResponse res,
+        final GridNearAtomicUpdateResponse res,
         boolean replicate,
         UpdateBatchResult batchRes,
         String taskName,
@@ -2659,7 +2659,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @return {@code True} if filter evaluation succeeded.
      */
     private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
-        GridNearAtomicMultipleUpdateResponse res) {
+        GridNearAtomicUpdateResponse res) {
         try {
             return ctx.isAllLocked(entry, req.filter());
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/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 8edd0d4..82a2a8c 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
@@ -510,9 +510,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
-                new CI2<GridNearAtomicMultipleUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicMultipleUpdateRequest req,
-                        GridNearAtomicMultipleUpdateResponse res) {
+                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicUpdateRequest req,
+                        GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -1208,6 +1208,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                 }
             }
 
+            optimize = false;
+
             if (optimize) {
                 return new GridNearAtomicSingleUpdateRequest(
                     cacheKey,

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 8c3ad88..a441302 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -640,14 +640,18 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$9
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$DeferredResponseBuffer
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$UpdateState$1
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse
 org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
 org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$2
 org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$3

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
index 0c005e9..3524181 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
@@ -426,7 +426,7 @@ public abstract class IgniteClientReconnectAbstractTest extends GridCommonAbstra
                 classes.put(((GridIoMessage)msg).message().getClass().getName(), node);
 
             if (msgCls0 != null && msg instanceof GridIoMessage
-                && ((GridIoMessage)msg).message().getClass().equals(msgCls)) {
+                && msgCls.isAssignableFrom(((GridIoMessage)msg).message().getClass())) {
                 log.info("Block message: " + msg);
 
                 return;

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index 37937d3..ea6f889 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal;
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -28,6 +29,7 @@ import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.Cache;
 import javax.cache.CacheException;
 import junit.framework.AssertionFailedError;
 import org.apache.ignite.Ignite;
@@ -50,6 +52,8 @@ import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse;
@@ -211,7 +215,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                             catch (CacheException e) {
                                 log.info("Expected exception: " + e);
 
-                                IgniteClientDisconnectedException e0 = (IgniteClientDisconnectedException) e.getCause();
+                                IgniteClientDisconnectedException e0 = (IgniteClientDisconnectedException)e.getCause();
 
                                 e0.reconnectFuture().get();
                             }
@@ -225,7 +229,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     }));
 
                     disconnectLatch.countDown();
-                } else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
+                }
+                else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
                     info("Reconnected: " + evt);
 
                     assertEquals(0, disconnectLatch.getCount());
@@ -340,7 +345,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     tx.commit();
 
                     fail();
-                } catch (IgniteClientDisconnectedException e) {
+                }
+                catch (IgniteClientDisconnectedException e) {
                     log.info("Expected error: " + e);
 
                     assertNotNull(e.reconnectFuture());
@@ -350,7 +356,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     txs.txStart();
 
                     fail();
-                } catch (IgniteClientDisconnectedException e) {
+                }
+                catch (IgniteClientDisconnectedException e) {
                     log.info("Expected error: " + e);
 
                     assertNotNull(e.reconnectFuture());
@@ -408,8 +415,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
     private void reconnectTransactionInProgress1(IgniteEx client,
         final TransactionConcurrency txConcurrency,
         final IgniteCache<Object, Object> cache)
-        throws Exception
-    {
+        throws Exception {
         Ignite srv = clientRouter(client);
 
         final TestTcpDiscoverySpi clientSpi = spi(client);
@@ -428,7 +434,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     info("Disconnected: " + evt);
 
                     disconnectLatch.countDown();
-                } else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
+                }
+                else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
                     info("Reconnected: " + evt);
 
                     reconnectLatch.countDown();
@@ -790,7 +797,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) {
             CacheAtomicWriteOrderMode[] writeOrders =
-                atomicityMode == ATOMIC ? values() : new CacheAtomicWriteOrderMode[]{CLOCK};
+                atomicityMode == ATOMIC ? values() : new CacheAtomicWriteOrderMode[] {CLOCK};
 
             for (CacheAtomicWriteOrderMode writeOrder : writeOrders) {
                 for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) {
@@ -805,14 +812,16 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     ccfg.setWriteSynchronizationMode(syncMode);
 
                     if (syncMode != FULL_ASYNC) {
-                        Class<?> cls = (ccfg.getAtomicityMode() == ATOMIC) ?
-                            GridNearAtomicMultipleUpdateResponse.class : GridNearTxPrepareResponse.class;
-
                         log.info("Test cache put [atomicity=" + atomicityMode +
                             ", writeOrder=" + writeOrder +
                             ", syncMode=" + syncMode + ']');
 
-                        checkOperationInProgressFails(client, ccfg, cls, putOp);
+                        if (ccfg.getAtomicityMode() == ATOMIC)
+                            checkOperationInProgressFails(client, ccfg, F.<Class<?>>asList(
+                                GridNearAtomicMultipleUpdateResponse.class, GridNearAtomicSingleUpdateResponse.class),
+                                putOp);
+                        else
+                            checkOperationInProgressFails(client, ccfg, GridNearTxPrepareResponse.class, putOp);
 
                         client.destroyCache(ccfg.getName());
                     }
@@ -1228,27 +1237,32 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
     /**
      *
      */
-    static class TestClass1 implements Serializable {}
+    static class TestClass1 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass2 implements Serializable {}
+    static class TestClass2 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass3 implements Serializable {}
+    static class TestClass3 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass4 implements Serializable {}
+    static class TestClass4 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass5 implements Serializable {}
+    static class TestClass5 implements Serializable {
+    }
 
     /**
      * @param client Client.
@@ -1261,8 +1275,22 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         final CacheConfiguration<Object, Object> ccfg,
         Class<?> msgToBlock,
         final IgniteInClosure<IgniteCache<Object, Object>> c)
-        throws Exception
-    {
+        throws Exception {
+        checkOperationInProgressFails(client, ccfg, F.<Class<?>>asList(msgToBlock), c);
+    }
+
+    /**
+     * @param client Client.
+     * @param ccfg Cache configuration.
+     * @param msgsToBlock Messages to block.
+     * @param c Cache operation closure.
+     * @throws Exception If failed.
+     */
+    private void checkOperationInProgressFails(IgniteEx client,
+        final CacheConfiguration<Object, Object> ccfg,
+        Collection<Class<?>> msgsToBlock,
+        final IgniteInClosure<IgniteCache<Object, Object>> c)
+        throws Exception {
         Ignite srv = clientRouter(client);
 
         TestTcpDiscoverySpi srvSpi = spi(srv);
@@ -1272,7 +1300,9 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         for (int i = 0; i < SRV_CNT; i++) {
             TestCommunicationSpi srvCommSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
 
-            srvCommSpi.blockMessages(msgToBlock, client.localNode().id());
+            for (Class<?> msgToBlock : msgsToBlock) {
+                srvCommSpi.blockMessages(msgToBlock, client.localNode().id());
+            }
         }
 
         IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Object>() {
@@ -1349,8 +1379,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         String cacheName,
         boolean cacheExists,
         boolean clientCache,
-        boolean clientNear)
-    {
+        boolean clientNear) {
         GridDiscoveryManager srvDisco = ((IgniteKernal)srv).context().discovery();
         GridDiscoveryManager clientDisco = ((IgniteKernal)client).context().discovery();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index d25ac37..5509496 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.testframework.GridTestUtils;
 
@@ -457,7 +458,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicMultipleUpdateResponse.class);
+            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 0633a1e..b56a8a6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.lang.IgniteInClosure;
@@ -141,6 +142,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
             commSpi.registerMessage(GridNearAtomicMultipleUpdateRequest.class);
             commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
             commSpi.registerMessage(GridDhtAtomicMultipleUpdateRequest.class);
+            commSpi.registerMessage(GridDhtAtomicSingleUpdateRequest.class);
 
             int putCnt = 15;
 
@@ -210,7 +212,8 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int dhtRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridDhtAtomicMultipleUpdateRequest.class);
+        return commSpi.messageCount(GridDhtAtomicMultipleUpdateRequest.class) +
+            commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index e3adc21..0786b49 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -480,7 +480,8 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             return delay && (
                 (origMsg instanceof GridNearAtomicMultipleUpdateRequest) ||
                 (origMsg instanceof GridNearAtomicSingleUpdateRequest) ||
-                (origMsg instanceof GridDhtAtomicMultipleUpdateRequest)
+                (origMsg instanceof GridDhtAtomicMultipleUpdateRequest) ||
+                (origMsg instanceof GridDhtAtomicSingleUpdateRequest)
             );
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20bbd613/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index a42f056..edd97bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -81,6 +81,7 @@ import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.internal.util.typedef.PAX;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -1156,12 +1157,14 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
      */
     private void checkEvents(final List<T3<Object, Object, Object>> expEvts, final CacheEventListener3 lsnr,
         boolean allowLoseEvt) throws Exception {
-        if (!allowLoseEvt)
+        if (!allowLoseEvt) {
+            U.sleep(2000);
             assert GridTestUtils.waitForCondition(new PA() {
                 @Override public boolean apply() {
                     return lsnr.evts.size() == expEvts.size();
                 }
             }, 2000L);
+        }
 
         for (T3<Object, Object, Object> exp : expEvts) {
             CacheEntryEvent<?, ?> e = lsnr.evts.get(exp.get1());


[31/51] [abbrv] ignite git commit: ignite-2523: Merge.

Posted by vo...@apache.org.
ignite-2523: Merge.


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

Branch: refs/heads/ignite-2523
Commit: daf501cb46e5d7076a267133bcd7f75aa09243c7
Parents: 1256485 bcaa0a8
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Fri Feb 19 16:25:32 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Fri Feb 19 16:25:32 2016 +0300

----------------------------------------------------------------------
 .gitignore                                      |    3 +
 DEVNOTES.txt                                    |    4 +-
 .../apache/ignite/IgniteSystemProperties.java   |   12 +-
 .../ignite/binary/BinaryBasicNameMapper.java    |    2 +-
 .../apache/ignite/cache/CacheMemoryMode.java    |    2 +
 .../cache/query/CacheQueryEntryEvent.java       |   48 +
 .../ignite/internal/GridJobCancelRequest.java   |    5 +
 .../ignite/internal/GridJobExecuteRequest.java  |    5 +
 .../ignite/internal/GridJobExecuteResponse.java |    5 +
 .../ignite/internal/GridJobSiblingsRequest.java |    5 +
 .../internal/GridJobSiblingsResponse.java       |    5 +
 .../internal/GridMessageListenHandler.java      |   16 +
 .../ignite/internal/GridTaskCancelRequest.java  |    5 +
 .../ignite/internal/GridTaskSessionRequest.java |    5 +
 .../apache/ignite/internal/IgniteKernal.java    |   14 +-
 .../ignite/internal/MarshallerContextImpl.java  |    3 +-
 .../internal/binary/BinaryClassDescriptor.java  |   22 +
 .../ignite/internal/binary/BinaryContext.java   |    1 +
 .../internal/binary/BinaryEnumObjectImpl.java   |    5 +
 .../internal/binary/BinaryObjectImpl.java       |    5 +
 .../binary/BinaryObjectOffheapImpl.java         |    5 +
 .../internal/binary/BinaryReaderExImpl.java     |    8 +-
 .../ignite/internal/binary/BinaryUtils.java     |   57 +-
 .../ignite/internal/binary/BinaryWriteMode.java |    3 +
 .../internal/binary/BinaryWriterExImpl.java     |   34 +
 .../internal/binary/GridBinaryMarshaller.java   |    3 +
 .../binary/builder/BinaryBuilderSerializer.java |   16 +-
 .../binary/builder/BinaryObjectBuilderImpl.java |   12 +-
 .../binary/builder/BinaryValueWithType.java     |    3 +-
 .../checkpoint/GridCheckpointRequest.java       |    5 +
 .../managers/communication/GridIoMessage.java   |    5 +
 .../communication/GridIoUserMessage.java        |    5 +
 .../deployment/GridDeploymentInfoBean.java      |    5 +
 .../deployment/GridDeploymentRequest.java       |    5 +
 .../deployment/GridDeploymentResponse.java      |    5 +
 .../eventstorage/GridEventStorageMessage.java   |    5 +
 .../affinity/AffinityTopologyVersion.java       |    5 +
 .../affinity/GridAffinityAssignment.java        |   36 +-
 .../affinity/GridAffinityAssignmentCache.java   |    2 +-
 .../cache/CacheEntryInfoCollection.java         |    5 +
 .../cache/CacheEntryPredicateAdapter.java       |    5 +
 .../cache/CacheEntryPredicateContainsValue.java |    8 +-
 .../cache/CacheEntrySerializablePredicate.java  |    5 +
 .../cache/CacheEvictableEntryImpl.java          |    6 +-
 .../processors/cache/CacheEvictionEntry.java    |    5 +
 .../cache/CacheInvokeDirectResult.java          |    5 +
 .../processors/cache/CacheLazyEntry.java        |    3 +
 .../cache/CacheObjectByteArrayImpl.java         |    5 +
 .../processors/cache/CacheObjectImpl.java       |    5 +
 .../processors/cache/GridCacheAdapter.java      |   58 +-
 .../cache/GridCacheAffinityManager.java         |   30 +-
 .../cache/GridCacheClearAllRunnable.java        |    2 +-
 .../processors/cache/GridCacheContext.java      |    4 +-
 .../cache/GridCacheDeploymentManager.java       |    8 +-
 .../processors/cache/GridCacheEntryEx.java      |   13 +-
 .../processors/cache/GridCacheEntryInfo.java    |    5 +
 .../cache/GridCacheEvictionManager.java         |    6 +-
 .../processors/cache/GridCacheMapEntry.java     |  325 +++--
 .../processors/cache/GridCacheMessage.java      |    5 +
 .../processors/cache/GridCacheMvccManager.java  |   42 +-
 .../processors/cache/GridCachePreloader.java    |    6 +
 .../cache/GridCachePreloaderAdapter.java        |    5 +
 .../processors/cache/GridCacheProcessor.java    |   22 +-
 .../processors/cache/GridCacheReturn.java       |    5 +
 .../processors/cache/GridCacheSwapManager.java  |   46 +-
 .../processors/cache/GridCacheTtlManager.java   |   75 +-
 .../processors/cache/GridCacheUtils.java        |   21 +-
 .../processors/cache/KeyCacheObjectImpl.java    |    5 +
 .../binary/CacheObjectBinaryProcessorImpl.java  |   21 +-
 .../CacheDataStructuresManager.java             |    4 +-
 .../dht/GridClientPartitionTopology.java        |    5 +
 .../distributed/dht/GridDhtCacheAdapter.java    |  101 +-
 .../distributed/dht/GridDhtCacheEntry.java      |    2 +-
 .../distributed/dht/GridDhtEmbeddedFuture.java  |   13 +-
 .../cache/distributed/dht/GridDhtGetFuture.java |  176 ++-
 .../distributed/dht/GridDhtGetSingleFuture.java |  476 +++++++
 .../distributed/dht/GridDhtLocalPartition.java  |   76 +-
 .../distributed/dht/GridDhtPartitionState.java  |    2 +-
 .../dht/GridDhtPartitionTopology.java           |    5 +
 .../dht/GridDhtPartitionTopologyImpl.java       |   25 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   40 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   86 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |   85 +-
 .../dht/colocated/GridDhtColocatedCache.java    |   40 +-
 .../dht/preloader/GridDhtPartitionDemander.java |    3 +-
 .../preloader/GridDhtPartitionExchangeId.java   |    5 +
 .../GridDhtPartitionsExchangeFuture.java        |    6 +
 .../dht/preloader/GridDhtPreloader.java         |   16 +
 .../distributed/near/CacheVersionedValue.java   |    5 +
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 ...arOptimisticSerializableTxPrepareFuture.java |    4 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   20 +-
 .../GridNearPessimisticTxPrepareFuture.java     |    2 +-
 .../cache/distributed/near/GridNearTxLocal.java |   67 +-
 .../cache/query/GridCacheQueryManager.java      |  454 ++++--
 .../cache/query/GridCacheSqlQuery.java          |    5 +
 .../continuous/CacheContinuousQueryEntry.java   |    5 +
 .../continuous/CacheContinuousQueryEvent.java   |   17 +-
 .../continuous/CacheContinuousQueryHandler.java |  121 +-
 .../CacheContinuousQueryListener.java           |    5 +-
 .../continuous/CacheContinuousQueryManager.java |  179 ++-
 .../cache/transactions/IgniteTxEntry.java       |    5 +
 .../cache/transactions/IgniteTxKey.java         |    5 +
 .../transactions/IgniteTxLocalAdapter.java      |    4 +-
 .../cache/transactions/TxEntryValueHolder.java  |    5 +
 .../cache/version/GridCacheVersion.java         |    5 +
 .../IgniteCacheObjectProcessorImpl.java         |    2 +-
 .../clock/GridClockDeltaSnapshotMessage.java    |    5 +
 .../processors/clock/GridClockDeltaVersion.java |    5 +
 .../continuous/GridContinuousMessage.java       |    5 +
 .../continuous/GridContinuousProcessor.java     |   60 +-
 .../datastreamer/DataStreamerEntry.java         |    5 +
 .../datastreamer/DataStreamerImpl.java          |    6 +-
 .../datastreamer/DataStreamerRequest.java       |    5 +
 .../datastreamer/DataStreamerResponse.java      |    5 +
 .../datastructures/DataStructuresProcessor.java |    1 +
 .../GridCacheAtomicReferenceImpl.java           |   68 +-
 .../processors/igfs/IgfsAckMessage.java         |    5 +
 .../internal/processors/igfs/IgfsBlockKey.java  |    5 +
 .../processors/igfs/IgfsBlocksMessage.java      |    5 +
 .../processors/igfs/IgfsDeleteMessage.java      |    5 +
 .../processors/igfs/IgfsFileAffinityRange.java  |    5 +
 .../igfs/IgfsFragmentizerRequest.java           |    5 +
 .../igfs/IgfsFragmentizerResponse.java          |    5 +
 .../internal/processors/igfs/IgfsProcessor.java |   14 +
 .../processors/igfs/IgfsSyncMessage.java        |    5 +
 .../platform/PlatformNoopProcessor.java         |   10 +
 .../processors/platform/PlatformProcessor.java  |   20 +
 .../platform/PlatformProcessorImpl.java         |   35 +-
 .../callback/PlatformCallbackGateway.java       |   30 +
 .../callback/PlatformCallbackUtils.java         |   16 +-
 .../datastructures/PlatformAtomicReference.java |  141 ++
 .../datastructures/PlatformAtomicSequence.java  |  122 ++
 .../messages/GridQueryCancelRequest.java        |    5 +
 .../twostep/messages/GridQueryFailResponse.java |    5 +
 .../messages/GridQueryNextPageRequest.java      |    5 +
 .../messages/GridQueryNextPageResponse.java     |    5 +
 .../h2/twostep/messages/GridQueryRequest.java   |    5 +
 .../handlers/task/GridTaskResultRequest.java    |    5 +
 .../handlers/task/GridTaskResultResponse.java   |    5 +
 .../service/GridServiceProcessor.java           |  101 +-
 .../processors/service/GridServiceProxy.java    |   22 +-
 .../ignite/internal/util/GridByteArrayList.java |    5 +
 .../ignite/internal/util/GridLongList.java      |    5 +
 .../internal/util/GridMessageCollection.java    |    5 +
 .../internal/util/UUIDCollectionMessage.java    |    5 +
 .../util/future/GridCompoundFuture.java         |    2 +-
 .../util/nio/GridNioFinishedFuture.java         |    5 +
 .../ignite/internal/util/nio/GridNioFuture.java |    7 +-
 .../internal/util/nio/GridNioFutureImpl.java    |    5 +
 .../util/nio/GridNioRecoveryDescriptor.java     |    2 +
 .../ignite/internal/util/nio/GridNioServer.java |  150 +-
 .../util/nio/GridSelectorNioSessionImpl.java    |    2 +-
 .../util/nio/SelectedSelectionKeySet.java       |  132 ++
 .../org/apache/ignite/lang/IgniteBiTuple.java   |    6 +-
 .../optimized/OptimizedClassDescriptor.java     |   37 +-
 .../optimized/OptimizedMarshallerUtils.java     |    3 +
 .../optimized/OptimizedObjectInputStream.java   |   15 +-
 .../optimized/OptimizedObjectOutputStream.java  |    4 +-
 .../extensions/communication/Message.java       |    5 +
 .../jobstealing/JobStealingRequest.java         |    5 +
 .../communication/tcp/TcpCommunicationSpi.java  |   15 +
 .../ignite/spi/discovery/tcp/ServerImpl.java    |    5 +
 .../TcpDiscoveryCustomEventMessage.java         |   10 +-
 .../apache/ignite/spi/indexing/IndexingSpi.java |    4 +-
 .../internal/GridAffinityNoCacheSelfTest.java   |   13 +-
 .../GridMultithreadedJobStealingSelfTest.java   |    3 +-
 .../internal/GridNodeMetricsLogSelfTest.java    |   98 ++
 ...eClientReconnectContinuousProcessorTest.java |   32 +-
 .../BinaryObjectBuilderAdditionalSelfTest.java  |   91 +-
 ...naryObjectBuilderDefaultMappersSelfTest.java |   30 +-
 .../GridCommunicationSendMessageSelfTest.java   |    5 +
 .../communication/GridIoManagerSelfTest.java    |    5 +
 .../cache/CacheConfigurationLeakTest.java       |   62 +
 .../cache/CacheEnumOperationsAbstractTest.java  |  307 ++++
 .../CacheEnumOperationsSingleNodeTest.java      |   28 +
 .../cache/CacheEnumOperationsTest.java          |   28 +
 .../cache/GridCacheDeploymentSelfTest.java      |   78 +-
 .../GridCacheOffHeapValuesEvictionSelfTest.java |  210 +++
 .../processors/cache/GridCacheTestEntryEx.java  |    5 +-
 .../IgniteCacheEntryListenerAbstractTest.java   |  454 ++++--
 ...cheEntryListenerAtomicOffheapTieredTest.java |   32 +
 ...cheEntryListenerAtomicOffheapValuesTest.java |   32 +
 ...niteCacheEntryListenerExpiredEventsTest.java |  202 +++
 ...teCacheEntryListenerTxOffheapTieredTest.java |   32 +
 ...teCacheEntryListenerTxOffheapValuesTest.java |   32 +
 .../cache/IgniteCacheEntryListenerTxTest.java   |    1 +
 .../GridDataStreamerImplSelfTest.java           |   49 +-
 .../IgniteCacheNearRestartRollbackSelfTest.java |  278 ++++
 .../IgniteTxPreloadAbstractTest.java            |    2 +-
 .../near/GridCacheNearReadersSelfTest.java      |   19 +-
 .../GridCacheReplicatedPreloadSelfTest.java     |  211 ++-
 .../GridCacheEvictableEntryEqualsSelfTest.java  |   85 ++
 ...CacheAtomicLocalOffheapExpiryPolicyTest.java |   30 +
 ...gniteCacheAtomicOffheapExpiryPolicyTest.java |   30 +
 ...rimaryWriteOrderOffheapExpiryPolicyTest.java |   31 +
 ...teOrderWithStoreOffheapExpiryPolicyTest.java |   31 +
 ...AtomicReplicatedOffheapExpiryPolicyTest.java |   30 +
 ...eAtomicWithStoreOffheapExpiryPolicyTest.java |   30 +
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  169 ++-
 .../IgniteCacheExpiryPolicyTestSuite.java       |   13 +
 ...niteCacheTxLocalOffheapExpiryPolicyTest.java |   30 +
 .../IgniteCacheTxOffheapExpiryPolicyTest.java   |   30 +
 ...acheTxReplicatedOffheapExpiryPolicyTest.java |   30 +
 ...CacheTxWithStoreOffheapExpiryPolicyTest.java |   30 +
 .../continuous/CacheContinuousBatchAckTest.java |  355 +++++
 ...heContinuousBatchForceServerModeAckTest.java |   80 ++
 ...CacheContinuousQueryCounterAbstractTest.java |  612 ++++++++
 ...inuousQueryCounterPartitionedAtomicTest.java |   41 +
 ...ContinuousQueryCounterPartitionedTxTest.java |   41 +
 ...tinuousQueryCounterReplicatedAtomicTest.java |   41 +
 ...eContinuousQueryCounterReplicatedTxTest.java |   41 +
 ...ContinuousQueryFailoverAbstractSelfTest.java |   10 +
 ...tomicPrimaryWriteOrderOffheapTieredTest.java |   33 +
 ...tinuousQueryFailoverTxOffheapTieredTest.java |   32 +
 .../CacheContinuousQueryLostPartitionTest.java  |    4 +-
 ...acheContinuousQueryRandomOperationsTest.java | 1308 ++++++++++++++++++
 ...ridCacheContinuousQueryAbstractSelfTest.java |   19 +-
 ...eContinuousQueryAtomicOffheapTieredTest.java |   32 +
 ...eContinuousQueryAtomicOffheapValuesTest.java |   32 +
 ...CacheContinuousQueryTxOffheapTieredTest.java |   32 +
 ...CacheContinuousQueryTxOffheapValuesTest.java |   32 +
 ...IgniteCacheContinuousQueryReconnectTest.java |  192 +++
 .../igfs/IgfsProcessorValidationSelfTest.java   |   27 +
 .../GridServiceSerializationSelfTest.java       |  149 ++
 .../apache/ignite/lang/GridTupleSelfTest.java   |   42 +-
 .../communication/GridTestMessage.java          |    5 +
 ...namicProxySerializationMultiJvmSelfTest.java |  131 ++
 .../GridSessionCheckpointAbstractSelfTest.java  |    6 +-
 .../spi/communication/GridTestMessage.java      |    5 +
 .../tcp/TcpClientDiscoverySpiSelfTest.java      |    2 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |    2 +-
 .../junits/common/GridCommonAbstractTest.java   |    2 +-
 .../junits/multijvm/IgniteNodeRunner.java       |   16 +-
 .../junits/multijvm/IgniteProcessProxy.java     |   19 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |    5 +
 .../testsuites/IgniteBinaryBasicTestSuite.java  |    2 +
 .../testsuites/IgniteBinaryCacheTestSuite.java  |    2 +
 .../IgniteCacheEvictionSelfTestSuite.java       |    4 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |    2 +
 .../ignite/testsuites/IgniteCacheTestSuite.java |   10 +
 .../testsuites/IgniteCacheTestSuite2.java       |    6 +
 .../testsuites/IgniteKernalSelfTestSuite.java   |    2 +
 .../p2p/CacheDeploymentAffinityKeyMapper.java   |   35 +
 .../CacheDeploymentAlwaysTruePredicate2.java    |   30 +
 ...oymentCacheEntryEventSerializableFilter.java |   32 +
 .../p2p/CacheDeploymentCacheEntryListener.java  |   31 +
 ...CacheDeploymentCachePluginConfiguration.java |   74 +
 ...heDeploymentStoreSessionListenerFactory.java |   83 ++
 .../hadoop/fs/BasicHadoopFileSystemFactory.java |   22 +-
 .../fs/CachingHadoopFileSystemFactory.java      |    2 +-
 .../fs/KerberosHadoopFileSystemFactory.java     |  217 +++
 .../hadoop/jobtracker/HadoopJobTracker.java     |    5 +-
 ...KerberosHadoopFileSystemFactorySelfTest.java |  121 ++
 .../testsuites/IgniteHadoopTestSuite.java       |    3 +
 .../processors/query/h2/IgniteH2Indexing.java   |   95 +-
 .../query/h2/sql/GridSqlAggregateFunction.java  |   12 +-
 .../query/h2/sql/GridSqlQueryParser.java        |   30 +-
 .../query/h2/twostep/GridMergeIndex.java        |   32 +-
 .../h2/twostep/GridMergeIndexUnsorted.java      |   19 +-
 .../query/h2/twostep/GridMergeTable.java        |   16 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |    2 +-
 .../h2/twostep/msg/GridH2ValueMessage.java      |    5 +
 .../cache/CacheQueryBuildValueTest.java         |  144 ++
 .../CacheQueryOffheapEvictDataLostTest.java     |  138 ++
 .../CacheRandomOperationsMultithreadedTest.java |  507 +++++++
 .../cache/IgniteCacheAbstractQuerySelfTest.java |   10 +-
 .../cache/IgniteClientReconnectQueriesTest.java |    9 +-
 .../near/IgniteCacheQueryNodeFailTest.java      |  148 ++
 .../h2/GridIndexingSpiAbstractSelfTest.java     |   43 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   33 +
 .../IgniteCacheWithIndexingTestSuite.java       |    2 +
 .../cpp/common/include/ignite/common/exports.h  |   21 +-
 .../cpp/common/include/ignite/common/java.h     |   53 +-
 .../platforms/cpp/common/project/vs/module.def  |   15 +-
 modules/platforms/cpp/common/src/exports.cpp    |   58 +-
 modules/platforms/cpp/common/src/java.cpp       |  209 ++-
 modules/platforms/cpp/core-test/Makefile.am     |    1 +
 .../cpp/core-test/project/vs/core-test.vcxproj  |    1 +
 .../project/vs/core-test.vcxproj.filters        |    3 +
 .../cpp/core-test/src/cache_query_test.cpp      |   45 +
 .../platforms/cpp/core-test/src/cache_test.cpp  |   12 +
 .../cpp/core-test/src/interop_memory_test.cpp   |   95 ++
 .../ignite/cache/query/query_fields_row.h       |    2 +-
 .../include/ignite/impl/ignite_environment.h    |   19 +-
 .../cpp/core/src/impl/cache/cache_impl.cpp      |    2 +-
 .../cpp/core/src/impl/ignite_environment.cpp    |   30 +-
 .../Apache.Ignite.Core.Tests.csproj             |    8 +
 .../Binary/BinarySelfTest.cs                    |   32 +
 .../Binary/BinaryStructureTest.cs               |   38 +-
 .../Query/CacheQueriesCodeConfigurationTest.cs  |    4 +-
 .../DataStructures/AtomicReferenceTest.cs       |  239 ++++
 .../DataStructures/AtomicSequenceTest.cs        |  131 ++
 .../Apache.Ignite.Core.Tests/FutureTest.cs      |    1 +
 .../IgniteConfigurationSectionTest.cs           |   69 +
 .../IgniteConfigurationSerializerTest.cs        |  554 ++++++++
 .../Process/IgniteProcess.cs                    |   16 +
 .../ProcessExtensions.cs                        |   78 ++
 .../Apache.Ignite.Core.Tests/ReconnectTest.cs   |   96 ++
 .../dotnet/Apache.Ignite.Core.Tests/app.config  |   54 +
 .../Apache.Ignite.Core.csproj                   |   16 +
 .../Binary/IBinarySerializer.cs                 |    6 +-
 .../Cache/CachePartialUpdateException.cs        |    1 -
 .../Cache/Configuration/QueryEntity.cs          |    4 +-
 .../Cache/Store/CacheStoreAdapter.cs            |    1 -
 .../Apache.Ignite.Core/Cluster/ICluster.cs      |   14 +
 .../Common/ClientDisconnectedException.cs       |   97 ++
 .../Compute/ComputeTaskAdapter.cs               |    1 -
 .../Compute/ComputeTaskSplitAdapter.cs          |    1 -
 .../DataStructures/IAtomicReference.cs          |   64 +
 .../DataStructures/IAtomicSequence.cs           |   69 +
 .../Multicast/TcpDiscoveryMulticastIpFinder.cs  |    4 +-
 .../Tcp/Static/TcpDiscoveryStaticIpFinder.cs    |    6 +-
 .../Apache.Ignite.Core/Events/EventBase.cs      |    1 -
 .../dotnet/Apache.Ignite.Core/IIgnite.cs        |   28 +
 .../IgniteConfigurationSection.cs               |   80 ++
 .../IgniteConfigurationSection.xsd              |  281 ++++
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |   39 +
 .../Impl/Binary/BinaryReader.cs                 |    2 +-
 .../Impl/Binary/BinaryUtils.cs                  |  168 ++-
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |    2 +-
 .../Impl/Common/BooleanLowerCaseConverter.cs    |   60 +
 .../Apache.Ignite.Core/Impl/Common/Future.cs    |   14 +-
 .../Impl/Common/FutureType.cs                   |   18 +-
 .../Common/IgniteConfigurationXmlSerializer.cs  |  407 ++++++
 .../Impl/Common/TypeStringConverter.cs          |  115 ++
 .../Closure/ComputeAbstractClosureTask.cs       |    1 -
 .../Impl/Compute/ComputeTaskHolder.cs           |    2 +-
 .../Impl/DataStructures/AtomicReference.cs      |   92 ++
 .../Impl/DataStructures/AtomicSequence.cs       |   90 ++
 .../Impl/Events/EventTypeConverter.cs           |  133 ++
 .../Apache.Ignite.Core/Impl/ExceptionUtils.cs   |  110 +-
 .../Apache.Ignite.Core/Impl/Handle/Handle.cs    |    8 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |   82 +-
 .../Apache.Ignite.Core/Impl/IgniteProxy.cs      |   19 +
 .../Impl/Memory/PlatformMemoryStream.cs         |  320 ++++-
 .../Impl/Unmanaged/IgniteJniNativeMethods.cs    |   37 +
 .../Impl/Unmanaged/UnmanagedCallbackHandlers.cs |    3 +
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |   32 +-
 .../Impl/Unmanaged/UnmanagedUtils.cs            |   79 ++
 .../commands/tasks/VisorTasksCommand.scala      |    4 +-
 .../scala/org/apache/ignite/visor/visor.scala   |    4 +
 modules/yardstick/.gitignore                    |    2 +
 .../yardstick/cache/IgniteInvokeBenchmark.java  |   65 +
 .../cache/IgniteInvokeTxBenchmark.java          |   30 +
 .../tcp/ipfinder/zk/ZookeeperIpFinderTest.java  |    2 +-
 parent/pom.xml                                  |   93 +-
 pom.xml                                         |    2 +-
 348 files changed, 15613 insertions(+), 1578 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/daf501cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index cdf579d,b6f5adf..7e3887f
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@@ -614,25 -583,12 +614,30 @@@ public abstract class GridCacheMessage 
          }
      }
  
+     /** {@inheritDoc} */
+     @Override public void onAckReceived() {
+         // No-op.
+     }
+ 
      /**
 +     * @param bytes Byte array to unmarshal.
 +     * @param ctx Context.
 +     * @param ldr Loader.
 +     * @return Unmarshalled object.
 +     * @throws IgniteCheckedException If failed.
 +     */
 +    @Nullable protected <T> T unmarshal(@Nullable byte[] bytes, GridCacheSharedContext ctx, ClassLoader ldr)
 +        throws IgniteCheckedException {
 +        assert ldr != null;
 +        assert ctx != null;
 +
 +        if (bytes == null)
 +            return null;
 +
 +        return ctx.marshaller().unmarshal(bytes, ldr);
 +    }
 +
 +    /**
       * @param byteCol Collection to unmarshal.
       * @param ctx Context.
       * @param ldr Loader.

http://git-wip-us.apache.org/repos/asf/ignite/blob/daf501cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/daf501cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index e19a11a,58d704d..6823d77
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@@ -35,9 -35,9 +35,10 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
  import org.apache.ignite.internal.processors.cache.GridCacheContext;
  import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 +import org.apache.ignite.internal.processors.cache.GridCacheMessage;
  import org.apache.ignite.internal.processors.cache.KeyCacheObject;
  import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
+ import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryListener;
  import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
  import org.apache.ignite.internal.util.future.GridFutureAdapter;
  import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@@ -376,11 -374,10 +398,11 @@@ public class GridDhtAtomicUpdateFuture 
              cctx.mvcc().removeAtomicFuture(version());
  
              if (err != null) {
-                 if (!mappings.isEmpty()) {
+                 if (!mappings.isEmpty() && lsnrs != null) {
                      Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
  
 -                    exit: for (GridDhtAtomicUpdateRequest req : mappings.values()) {
 +                    exit:
 +                    for (GridDhtAtomicUpdateRequest req : mappings.values()) {
                          for (int i = 0; i < req.size(); i++) {
                              KeyCacheObject key = req.key(i);
  


[02/51] [abbrv] ignite git commit: IGNITE-2532: WIP. Only refactorings for now.

Posted by vo...@apache.org.
IGNITE-2532: WIP. Only refactorings for now.


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

Branch: refs/heads/ignite-2523
Commit: 29c2aee6b6ffac4f27da3732575f7d82b0e8bedd
Parents: 4665283
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 11:09:13 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 11:09:13 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAtomicFuture.java |    6 -
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |    5 -
 .../GridNearAtomicSingleUpdateFuture.java       | 1264 ------------------
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 1179 ++++++++--------
 4 files changed, 572 insertions(+), 1882 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/29c2aee6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
index 359909e..be24191 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.Collection;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -38,9 +37,4 @@ public interface GridCacheAtomicFuture<R> extends GridCacheFuture<R> {
      * @return Future or {@code null} if no need to wait.
      */
     public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer);
-
-    /**
-     * @return Future keys.
-     */
-    public Collection<?> keys();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/29c2aee6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 6891d3b..9fe60c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -201,11 +201,6 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
         return null;
     }
 
-    /** {@inheritDoc} */
-    @Override public Collection<KeyCacheObject> keys() {
-        return keys;
-    }
-
     /**
      * @param entry Entry to map.
      * @param val Value to write.

http://git-wip-us.apache.org/repos/asf/ignite/blob/29c2aee6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
deleted file mode 100644
index d633e47..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ /dev/null
@@ -1,1264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
-import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException;
-import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
-import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheMvccManager;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheReturn;
-import org.apache.ignite.internal.processors.cache.GridCacheTryPutFailedException;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache;
-import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.future.GridFinishedFuture;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.CI1;
-import org.apache.ignite.internal.util.typedef.CI2;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.expiry.ExpiryPolicy;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-
-/**
- * DHT atomic cache single near update future.
- */
-public class GridNearAtomicSingleUpdateFuture extends GridFutureAdapter<Object>
-    implements GridCacheAtomicFuture<Object>{
-    /** Logger reference. */
-    private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
-    /** Logger. */
-    protected static IgniteLogger log;
-
-    /** Cache context. */
-    private final GridCacheContext cctx;
-
-    /** Cache. */
-    private GridDhtAtomicCache cache;
-
-    /** Update operation. */
-    private final GridCacheOperation op;
-
-    /** Keys */
-    private Collection<?> keys;
-
-    /** Values. */
-    @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
-    private Collection<?> vals;
-
-    /** Optional arguments for entry processor. */
-    private Object[] invokeArgs;
-
-    /** Conflict put values. */
-    @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
-    private Collection<GridCacheDrInfo> conflictPutVals;
-
-    /** Conflict remove values. */
-    @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
-    private Collection<GridCacheVersion> conflictRmvVals;
-
-    /** Return value require flag. */
-    private final boolean retval;
-
-    /** Expiry policy. */
-    private final ExpiryPolicy expiryPlc;
-
-    /** Optional filter. */
-    private final CacheEntryPredicate[] filter;
-
-    /** Write synchronization mode. */
-    private final CacheWriteSynchronizationMode syncMode;
-
-    /** Raw return value flag. */
-    private final boolean rawRetval;
-
-    /** Fast map flag. */
-    private final boolean fastMap;
-
-    /** Near cache flag. */
-    private final boolean nearEnabled;
-
-    /** Subject ID. */
-    private final UUID subjId;
-
-    /** Task name hash. */
-    private final int taskNameHash;
-
-    /** Topology locked flag. Set if atomic update is performed inside a TX or explicit lock. */
-    private boolean topLocked;
-
-    /** Skip store flag. */
-    private final boolean skipStore;
-
-    /** */
-    private final boolean keepBinary;
-
-    /** Wait for topology future flag. */
-    private final boolean waitTopFut;
-
-    /** Remap count. */
-    private int remapCnt;
-
-    /** State. */
-    private final UpdateState state;
-
-    /**
-     * @param cctx Cache context.
-     * @param cache Cache instance.
-     * @param syncMode Write synchronization mode.
-     * @param op Update operation.
-     * @param keys Keys to update.
-     * @param vals Values or transform closure.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param conflictPutVals Conflict put values (optional).
-     * @param conflictRmvVals Conflict remove values (optional).
-     * @param retval Return value require flag.
-     * @param rawRetval {@code True} if should return {@code GridCacheReturn} as future result.
-     * @param expiryPlc Expiry policy explicitly specified for cache operation.
-     * @param filter Entry filter.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param skipStore Skip store flag.
-     * @param keepBinary Keep binary flag.
-     * @param remapCnt Maximum number of retries.
-     * @param waitTopFut If {@code false} does not wait for affinity change future.
-     */
-    public GridNearAtomicSingleUpdateFuture(
-        GridCacheContext cctx,
-        GridDhtAtomicCache cache,
-        CacheWriteSynchronizationMode syncMode,
-        GridCacheOperation op,
-        Collection<?> keys,
-        @Nullable Collection<?> vals,
-        @Nullable Object[] invokeArgs,
-        @Nullable Collection<GridCacheDrInfo> conflictPutVals,
-        @Nullable Collection<GridCacheVersion> conflictRmvVals,
-        final boolean retval,
-        final boolean rawRetval,
-        @Nullable ExpiryPolicy expiryPlc,
-        final CacheEntryPredicate[] filter,
-        UUID subjId,
-        int taskNameHash,
-        boolean skipStore,
-        boolean keepBinary,
-        int remapCnt,
-        boolean waitTopFut
-    ) {
-        this.rawRetval = rawRetval;
-
-        assert vals == null || vals.size() == keys.size();
-        assert conflictPutVals == null || conflictPutVals.size() == keys.size();
-        assert conflictRmvVals == null || conflictRmvVals.size() == keys.size();
-        assert subjId != null;
-
-        this.cctx = cctx;
-        this.cache = cache;
-        this.syncMode = syncMode;
-        this.op = op;
-        this.keys = keys;
-        this.vals = vals;
-        this.invokeArgs = invokeArgs;
-        this.conflictPutVals = conflictPutVals;
-        this.conflictRmvVals = conflictRmvVals;
-        this.retval = retval;
-        this.expiryPlc = expiryPlc;
-        this.filter = filter;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.skipStore = skipStore;
-        this.keepBinary = keepBinary;
-        this.waitTopFut = waitTopFut;
-
-        if (log == null)
-            log = U.logger(cctx.kernalContext(), logRef, GridFutureAdapter.class);
-
-        fastMap = F.isEmpty(filter) && op != TRANSFORM && cctx.config().getWriteSynchronizationMode() == FULL_SYNC &&
-            cctx.config().getAtomicWriteOrderMode() == CLOCK &&
-            !(cctx.writeThrough() && cctx.config().getInterceptor() != null);
-
-        nearEnabled = CU.isNearEnabled(cctx);
-
-        if (!waitTopFut)
-            remapCnt = 1;
-
-        this.remapCnt = remapCnt;
-
-        state = new UpdateState();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteUuid futureId() {
-        throw new UnsupportedOperationException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion version() {
-        return state.futureVersion();
-    }
-
-    /**
-     * @return {@code True} if this future should block partition map exchange.
-     */
-    private boolean waitForPartitionExchange() {
-        // Wait fast-map near atomic update futures in CLOCK mode.
-        return fastMap;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<?> keys() {
-        return keys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onNodeLeft(UUID nodeId) {
-        state.onNodeLeft(nodeId);
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean trackable() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void markNotTrackable() {
-        // No-op.
-    }
-
-    /**
-     * Performs future mapping.
-     */
-    public void map() {
-        AffinityTopologyVersion topVer = cctx.shared().lockedTopologyVersion(null);
-
-        if (topVer == null)
-            mapOnTopology();
-        else {
-            topLocked = true;
-
-            // Cannot remap.
-            remapCnt = 1;
-
-            state.map(topVer, null);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
-        if (waitForPartitionExchange()) {
-            GridFutureAdapter<Void> fut = state.completeFuture(topVer);
-
-            if (fut != null && isDone()) {
-                fut.onDone();
-
-                return null;
-            }
-
-            return fut;
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("ConstantConditions")
-    @Override public boolean onDone(@Nullable Object res, @Nullable Throwable err) {
-        assert res == null || res instanceof GridCacheReturn;
-
-        GridCacheReturn ret = (GridCacheReturn)res;
-
-        Object retval =
-            res == null ? null : rawRetval ? ret : (this.retval || op == TRANSFORM) ?
-                cctx.unwrapBinaryIfNeeded(ret.value(), keepBinary) : ret.success();
-
-        if (op == TRANSFORM && retval == null)
-            retval = Collections.emptyMap();
-
-        if (super.onDone(retval, err)) {
-            GridCacheVersion futVer = state.onFutureDone();
-
-            if (futVer != null)
-                cctx.mvcc().removeAtomicFuture(futVer);
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Response callback.
-     *
-     * @param nodeId Node ID.
-     * @param res Update response.
-     */
-    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
-        state.onResult(nodeId, res, false);
-    }
-
-    /**
-     * Updates near cache.
-     *
-     * @param req Update request.
-     * @param res Update response.
-     */
-    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
-        assert nearEnabled;
-
-        if (res.remapKeys() != null || !req.hasPrimary())
-            return;
-
-        GridNearAtomicCache near = (GridNearAtomicCache)cctx.dht().near();
-
-        near.processNearAtomicUpdateResponse(req, res);
-    }
-
-    /**
-     * Maps future on ready topology.
-     */
-    private void mapOnTopology() {
-        cache.topology().readLock();
-
-        AffinityTopologyVersion topVer = null;
-
-        try {
-            if (cache.topology().stopping()) {
-                onDone(new IgniteCheckedException("Failed to perform cache operation (cache is stopped): " +
-                    cache.name()));
-
-                return;
-            }
-
-            GridDhtTopologyFuture fut = cache.topology().topologyVersionFuture();
-
-            if (fut.isDone()) {
-                Throwable err = fut.validateCache(cctx);
-
-                if (err != null) {
-                    onDone(err);
-
-                    return;
-                }
-
-                topVer = fut.topologyVersion();
-            }
-            else {
-                if (waitTopFut) {
-                    assert !topLocked : this;
-
-                    fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
-                        @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
-                            cctx.kernalContext().closure().runLocalSafe(new Runnable() {
-                                @Override public void run() {
-                                    mapOnTopology();
-                                }
-                            });
-                        }
-                    });
-                }
-                else
-                    onDone(new GridCacheTryPutFailedException());
-
-                return;
-            }
-        }
-        finally {
-            cache.topology().readUnlock();
-        }
-
-        state.map(topVer, null);
-    }
-
-    /**
-     * @return {@code True} future is stored by {@link GridCacheMvccManager#addAtomicFuture}.
-     */
-    private boolean storeFuture() {
-        return cctx.config().getAtomicWriteOrderMode() == CLOCK || syncMode != FULL_ASYNC;
-    }
-
-    /**
-     * Maps key to nodes. If filters are absent and operation is not TRANSFORM, then we can assign version on near
-     * node and send updates in parallel to all participating nodes.
-     *
-     * @param key Key to map.
-     * @param topVer Topology version to map.
-     * @param fastMap Flag indicating whether mapping is performed for fast-circuit update.
-     * @return Collection of nodes to which key is mapped.
-     */
-    private Collection<ClusterNode> mapKey(
-        KeyCacheObject key,
-        AffinityTopologyVersion topVer,
-        boolean fastMap
-    ) {
-        GridCacheAffinityManager affMgr = cctx.affinity();
-
-        // If we can send updates in parallel - do it.
-        return fastMap ?
-            cctx.topology().nodes(affMgr.partition(key), topVer) :
-            Collections.singletonList(affMgr.primary(key, topVer));
-    }
-
-    /**
-     * Maps future to single node.
-     *
-     * @param nodeId Node ID.
-     * @param req Request.
-     */
-    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
-        if (cctx.localNodeId().equals(nodeId)) {
-            cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
-                        onResult(res.nodeId(), res);
-                    }
-                });
-        }
-        else {
-            try {
-                if (log.isDebugEnabled())
-                    log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
-                cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
-
-                if (syncMode == FULL_ASYNC)
-                    onDone(new GridCacheReturn(cctx, true, true, null, true));
-            }
-            catch (IgniteCheckedException e) {
-                state.onSendError(req, e);
-            }
-        }
-    }
-
-    /**
-     * Sends messages to remote nodes and updates local cache.
-     *
-     * @param mappings Mappings to send.
-     */
-    private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
-        UUID locNodeId = cctx.localNodeId();
-
-        GridNearAtomicUpdateRequest locUpdate = null;
-
-        // Send messages to remote nodes first, then run local update.
-        for (GridNearAtomicUpdateRequest req : mappings.values()) {
-            if (locNodeId.equals(req.nodeId())) {
-                assert locUpdate == null : "Cannot have more than one local mapping [locUpdate=" + locUpdate +
-                    ", req=" + req + ']';
-
-                locUpdate = req;
-            }
-            else {
-                try {
-                    if (log.isDebugEnabled())
-                        log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
-                    cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
-                }
-                catch (IgniteCheckedException e) {
-                    state.onSendError(req, e);
-                }
-            }
-        }
-
-        if (locUpdate != null) {
-            cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
-                        onResult(res.nodeId(), res);
-                    }
-                });
-        }
-
-        if (syncMode == FULL_ASYNC)
-            onDone(new GridCacheReturn(cctx, true, true, null, true));
-    }
-
-    /**
-     *
-     */
-    private class UpdateState {
-        /** Current topology version. */
-        private AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
-
-        /** */
-        private GridCacheVersion updVer;
-
-        /** Topology version when got mapping error. */
-        private AffinityTopologyVersion mapErrTopVer;
-
-        /** Mappings if operations is mapped to more than one node. */
-        @GridToStringInclude
-        private Map<UUID, GridNearAtomicUpdateRequest> mappings;
-
-        /** */
-        private int resCnt;
-
-        /** Error. */
-        private CachePartialUpdateCheckedException err;
-
-        /** Future ID. */
-        private GridCacheVersion futVer;
-
-        /** Completion future for a particular topology version. */
-        private GridFutureAdapter<Void> topCompleteFut;
-
-        /** Keys to remap. */
-        private Collection<KeyCacheObject> remapKeys;
-
-        /** Not null is operation is mapped to single node. */
-        private GridNearAtomicUpdateRequest singleReq;
-
-        /** Operation result. */
-        private GridCacheReturn opRes;
-
-        /**
-         * @return Future version.
-         */
-        @Nullable synchronized GridCacheVersion futureVersion() {
-            return futVer;
-        }
-
-        /**
-         * @param nodeId Left node ID.
-         */
-        void onNodeLeft(UUID nodeId) {
-            GridNearAtomicUpdateResponse res = null;
-
-            synchronized (this) {
-                GridNearAtomicUpdateRequest req;
-
-                if (singleReq != null)
-                    req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
-                else
-                    req = mappings != null ? mappings.get(nodeId) : null;
-
-                if (req != null && req.response() == null) {
-                    res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
-                        nodeId,
-                        req.futureVersion(),
-                        cctx.deploymentEnabled());
-
-                    ClusterTopologyCheckedException e = new ClusterTopologyCheckedException("Primary node left grid " +
-                        "before response is received: " + nodeId);
-
-                    e.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(req.topologyVersion()));
-
-                    res.addFailedKeys(req.keys(), e);
-                }
-            }
-
-            if (res != null)
-                onResult(nodeId, res, true);
-        }
-
-        /**
-         * @param nodeId Node ID.
-         * @param res Response.
-         * @param nodeErr {@code True} if response was created on node failure.
-         */
-        @SuppressWarnings("unchecked")
-        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
-            GridNearAtomicUpdateRequest req;
-
-            AffinityTopologyVersion remapTopVer = null;
-
-            GridCacheReturn opRes0 = null;
-            CachePartialUpdateCheckedException err0 = null;
-
-            boolean rcvAll;
-
-            GridFutureAdapter<?> fut0 = null;
-
-            synchronized (this) {
-                if (!res.futureVersion().equals(futVer))
-                    return;
-
-                if (singleReq != null) {
-                    if (!singleReq.nodeId().equals(nodeId))
-                        return;
-
-                    req = singleReq;
-
-                    singleReq = null;
-
-                    rcvAll = true;
-                }
-                else {
-                    req = mappings != null ? mappings.get(nodeId) : null;
-
-                    if (req != null && req.onResponse(res)) {
-                        resCnt++;
-
-                        rcvAll = mappings.size() == resCnt;
-                    }
-                    else
-                        return;
-                }
-
-                assert req != null && req.topologyVersion().equals(topVer) : req;
-
-                if (res.remapKeys() != null) {
-                    assert !fastMap || cctx.kernalContext().clientNode();
-
-                    if (remapKeys == null)
-                        remapKeys = U.newHashSet(res.remapKeys().size());
-
-                    remapKeys.addAll(res.remapKeys());
-
-                    if (mapErrTopVer == null || mapErrTopVer.compareTo(req.topologyVersion()) < 0)
-                        mapErrTopVer = req.topologyVersion();
-                }
-                else if (res.error() != null) {
-                    if (res.failedKeys() != null)
-                        addFailedKeys(res.failedKeys(), req.topologyVersion(), res.error());
-                }
-                else {
-                    if (!req.fastMap() || req.hasPrimary()) {
-                        GridCacheReturn ret = res.returnValue();
-
-                        if (op == TRANSFORM) {
-                            if (ret != null)
-                                addInvokeResults(ret);
-                        }
-                        else
-                            opRes = ret;
-                    }
-                }
-
-                if (rcvAll) {
-                    if (remapKeys != null) {
-                        assert mapErrTopVer != null;
-
-                        remapTopVer = new AffinityTopologyVersion(mapErrTopVer.topologyVersion() + 1);
-                    }
-                    else {
-                        if (err != null &&
-                            X.hasCause(err, CachePartialUpdateCheckedException.class) &&
-                            X.hasCause(err, ClusterTopologyCheckedException.class) &&
-                            storeFuture() &&
-                            --remapCnt > 0) {
-                            ClusterTopologyCheckedException topErr =
-                                X.cause(err, ClusterTopologyCheckedException.class);
-
-                            if (!(topErr instanceof ClusterTopologyServerNotFoundException)) {
-                                CachePartialUpdateCheckedException cause =
-                                    X.cause(err, CachePartialUpdateCheckedException.class);
-
-                                assert cause != null && cause.topologyVersion() != null : err;
-
-                                remapTopVer =
-                                    new AffinityTopologyVersion(cause.topologyVersion().topologyVersion() + 1);
-
-                                err = null;
-
-                                Collection<Object> failedKeys = cause.failedKeys();
-
-                                remapKeys = new ArrayList<>(failedKeys.size());
-
-                                for (Object key : failedKeys)
-                                    remapKeys.add(cctx.toCacheKeyObject(key));
-
-                                updVer = null;
-                            }
-                        }
-                    }
-
-                    if (remapTopVer == null) {
-                        err0 = err;
-                        opRes0 = opRes;
-                    }
-                    else {
-                        fut0 = topCompleteFut;
-
-                        topCompleteFut = null;
-
-                        cctx.mvcc().removeAtomicFuture(futVer);
-
-                        futVer = null;
-                        topVer = AffinityTopologyVersion.ZERO;
-                    }
-                }
-            }
-
-            if (res.error() != null && res.failedKeys() == null) {
-                onDone(res.error());
-
-                return;
-            }
-
-            if (rcvAll && nearEnabled) {
-                if (mappings != null) {
-                    for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
-                        GridNearAtomicUpdateResponse res0 = req0.response();
-
-                        assert res0 != null : req0;
-
-                        updateNear(req0, res0);
-                    }
-                }
-                else if (!nodeErr)
-                    updateNear(req, res);
-            }
-
-            if (remapTopVer != null) {
-                if (fut0 != null)
-                    fut0.onDone();
-
-                if (!waitTopFut) {
-                    onDone(new GridCacheTryPutFailedException());
-
-                    return;
-                }
-
-                if (topLocked) {
-                    assert !F.isEmpty(remapKeys) : remapKeys;
-
-                    CachePartialUpdateCheckedException e =
-                        new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
-
-                    ClusterTopologyCheckedException cause = new ClusterTopologyCheckedException(
-                        "Failed to update keys, topology changed while execute atomic update inside transaction.");
-
-                    cause.retryReadyFuture(cctx.affinity().affinityReadyFuture(remapTopVer));
-
-                    e.add(remapKeys, cause);
-
-                    onDone(e);
-
-                    return;
-                }
-
-                IgniteInternalFuture<AffinityTopologyVersion> fut =
-                    cctx.shared().exchange().affinityReadyFuture(remapTopVer);
-
-                if (fut == null)
-                    fut = new GridFinishedFuture<>(remapTopVer);
-
-                fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
-                    @Override public void apply(final IgniteInternalFuture<AffinityTopologyVersion> fut) {
-                        cctx.kernalContext().closure().runLocalSafe(new Runnable() {
-                            @Override public void run() {
-                                try {
-                                    AffinityTopologyVersion topVer = fut.get();
-
-                                    map(topVer, remapKeys);
-                                }
-                                catch (IgniteCheckedException e) {
-                                    onDone(e);
-                                }
-                            }
-                        });
-                    }
-                });
-
-                return;
-            }
-
-            if (rcvAll)
-                onDone(opRes0, err0);
-        }
-
-        /**
-         * @param req Request.
-         * @param e Error.
-         */
-        void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
-            synchronized (this) {
-                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
-                    req.nodeId(),
-                    req.futureVersion(),
-                    cctx.deploymentEnabled());
-
-                res.addFailedKeys(req.keys(), e);
-
-                onResult(req.nodeId(), res, true);
-            }
-        }
-
-        /**
-         * @param topVer Topology version.
-         * @param remapKeys Keys to remap.
-         */
-        void map(AffinityTopologyVersion topVer, @Nullable Collection<KeyCacheObject> remapKeys) {
-            Collection<ClusterNode> topNodes = CU.affinityNodes(cctx, topVer);
-
-            if (F.isEmpty(topNodes)) {
-                onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
-                    "left the grid)."));
-
-                return;
-            }
-
-            Exception err = null;
-            GridNearAtomicUpdateRequest singleReq0 = null;
-            Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
-
-            int size = keys.size();
-
-            GridCacheVersion futVer = cctx.versions().next(topVer);
-
-            GridCacheVersion updVer;
-
-            // Assign version on near node in CLOCK ordering mode even if fastMap is false.
-            if (cctx.config().getAtomicWriteOrderMode() == CLOCK) {
-                updVer = this.updVer;
-
-                if (updVer == null) {
-                    updVer = cctx.versions().next(topVer);
-
-                    if (log.isDebugEnabled())
-                        log.debug("Assigned fast-map version for update on near node: " + updVer);
-                }
-            }
-            else
-                updVer = null;
-
-            try {
-                if (size == 1 && !fastMap) {
-                    assert remapKeys == null || remapKeys.size() == 1;
-
-                    singleReq0 = mapSingleUpdate(topVer, futVer, updVer);
-                }
-                else {
-                    Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
-                        topVer,
-                        futVer,
-                        updVer,
-                        remapKeys);
-
-                    if (pendingMappings.size() == 1)
-                        singleReq0 = F.firstValue(pendingMappings);
-                    else {
-                        if (syncMode == PRIMARY_SYNC) {
-                            mappings0 = U.newHashMap(pendingMappings.size());
-
-                            for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
-                                if (req.hasPrimary())
-                                    mappings0.put(req.nodeId(), req);
-                            }
-                        }
-                        else
-                            mappings0 = pendingMappings;
-
-                        assert !mappings0.isEmpty() || size == 0 : GridNearAtomicSingleUpdateFuture.this;
-                    }
-                }
-
-                synchronized (this) {
-                    assert this.futVer == null : this;
-                    assert this.topVer == AffinityTopologyVersion.ZERO : this;
-
-                    this.topVer = topVer;
-                    this.updVer = updVer;
-                    this.futVer = futVer;
-
-                    resCnt = 0;
-
-                    singleReq = singleReq0;
-                    mappings = mappings0;
-
-                    this.remapKeys = null;
-                }
-            }
-            catch (Exception e) {
-                err = e;
-            }
-
-            if (err != null) {
-                onDone(err);
-
-                return;
-            }
-
-            if (storeFuture()) {
-                if (!cctx.mvcc().addAtomicFuture(futVer, GridNearAtomicSingleUpdateFuture.this)) {
-                    assert isDone() : GridNearAtomicSingleUpdateFuture.this;
-
-                    return;
-                }
-            }
-
-            // Optimize mapping for single key.
-            if (singleReq0 != null)
-                mapSingle(singleReq0.nodeId(), singleReq0);
-            else {
-                assert mappings0 != null;
-
-                if (size == 0)
-                    onDone(new GridCacheReturn(cctx, true, true, null, true));
-                else
-                    doUpdate(mappings0);
-            }
-        }
-
-        /**
-         * @param topVer Topology version.
-         * @return Future.
-         */
-        @Nullable synchronized GridFutureAdapter<Void> completeFuture(AffinityTopologyVersion topVer) {
-            if (this.topVer == AffinityTopologyVersion.ZERO)
-                return null;
-
-            if (this.topVer.compareTo(topVer) < 0) {
-                if (topCompleteFut == null)
-                    topCompleteFut = new GridFutureAdapter<>();
-
-                return topCompleteFut;
-            }
-
-            return null;
-        }
-
-        /**
-         * @return Future version.
-         */
-        GridCacheVersion onFutureDone() {
-            GridCacheVersion ver0;
-
-            GridFutureAdapter<Void> fut0;
-
-            synchronized (this) {
-                fut0 = topCompleteFut;
-
-                topCompleteFut = null;
-
-                ver0 = futVer;
-
-                futVer = null;
-            }
-
-            if (fut0 != null)
-                fut0.onDone();
-
-            return ver0;
-        }
-
-        /**
-         * @param topNodes Cache nodes.
-         * @param topVer Topology version.
-         * @param futVer Future version.
-         * @param updVer Update version.
-         * @param remapKeys Keys to remap.
-         * @return Mapping.
-         * @throws Exception If failed.
-         */
-        private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
-            AffinityTopologyVersion topVer,
-            GridCacheVersion futVer,
-            @Nullable GridCacheVersion updVer,
-            @Nullable Collection<KeyCacheObject> remapKeys) throws Exception {
-            Iterator<?> it = null;
-
-            if (vals != null)
-                it = vals.iterator();
-
-            Iterator<GridCacheDrInfo> conflictPutValsIt = null;
-
-            if (conflictPutVals != null)
-                conflictPutValsIt = conflictPutVals.iterator();
-
-            Iterator<GridCacheVersion> conflictRmvValsIt = null;
-
-            if (conflictRmvVals != null)
-                conflictRmvValsIt = conflictRmvVals.iterator();
-
-            Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
-
-            // Create mappings first, then send messages.
-            for (Object key : keys) {
-                if (key == null)
-                    throw new NullPointerException("Null key.");
-
-                Object val;
-                GridCacheVersion conflictVer;
-                long conflictTtl;
-                long conflictExpireTime;
-
-                if (vals != null) {
-                    val = it.next();
-                    conflictVer = null;
-                    conflictTtl = CU.TTL_NOT_CHANGED;
-                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-
-                    if (val == null)
-                        throw new NullPointerException("Null value.");
-                }
-                else if (conflictPutVals != null) {
-                    GridCacheDrInfo conflictPutVal = conflictPutValsIt.next();
-
-                    val = conflictPutVal.valueEx();
-                    conflictVer = conflictPutVal.version();
-                    conflictTtl =  conflictPutVal.ttl();
-                    conflictExpireTime = conflictPutVal.expireTime();
-                }
-                else if (conflictRmvVals != null) {
-                    val = null;
-                    conflictVer = conflictRmvValsIt.next();
-                    conflictTtl = CU.TTL_NOT_CHANGED;
-                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-                }
-                else {
-                    val = null;
-                    conflictVer = null;
-                    conflictTtl = CU.TTL_NOT_CHANGED;
-                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-                }
-
-                if (val == null && op != GridCacheOperation.DELETE)
-                    continue;
-
-                KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
-
-                if (remapKeys != null && !remapKeys.contains(cacheKey))
-                    continue;
-
-                if (op != TRANSFORM)
-                    val = cctx.toCacheObject(val);
-
-                Collection<ClusterNode> affNodes = mapKey(cacheKey, topVer, fastMap);
-
-                if (affNodes.isEmpty())
-                    throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                        "(all partition nodes left the grid).");
-
-                int i = 0;
-
-                for (ClusterNode affNode : affNodes) {
-                    if (affNode == null)
-                        throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                            "(all partition nodes left the grid).");
-
-                    UUID nodeId = affNode.id();
-
-                    GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
-
-                    if (mapped == null) {
-                        mapped = new GridNearAtomicUpdateRequest(
-                            cctx.cacheId(),
-                            nodeId,
-                            futVer,
-                            fastMap,
-                            updVer,
-                            topVer,
-                            topLocked,
-                            syncMode,
-                            op,
-                            retval,
-                            expiryPlc,
-                            invokeArgs,
-                            filter,
-                            subjId,
-                            taskNameHash,
-                            skipStore,
-                            keepBinary,
-                            cctx.kernalContext().clientNode(),
-                            cctx.deploymentEnabled(),
-                            keys.size());
-
-                        pendingMappings.put(nodeId, mapped);
-                    }
-
-                    mapped.addUpdateEntry(cacheKey, val, conflictTtl, conflictExpireTime, conflictVer, i == 0);
-
-                    i++;
-                }
-            }
-
-            return pendingMappings;
-        }
-
-        /**
-         * @param topVer Topology version.
-         * @param futVer Future version.
-         * @param updVer Update version.
-         * @return Request.
-         * @throws Exception If failed.
-         */
-        private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
-            GridCacheVersion futVer,
-            @Nullable GridCacheVersion updVer) throws Exception {
-            Object key = F.first(keys);
-
-            Object val;
-            GridCacheVersion conflictVer;
-            long conflictTtl;
-            long conflictExpireTime;
-
-            if (vals != null) {
-                // Regular PUT.
-                val = F.first(vals);
-                conflictVer = null;
-                conflictTtl = CU.TTL_NOT_CHANGED;
-                conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-            }
-            else if (conflictPutVals != null) {
-                // Conflict PUT.
-                GridCacheDrInfo conflictPutVal = F.first(conflictPutVals);
-
-                val = conflictPutVal.valueEx();
-                conflictVer = conflictPutVal.version();
-                conflictTtl = conflictPutVal.ttl();
-                conflictExpireTime = conflictPutVal.expireTime();
-            }
-            else if (conflictRmvVals != null) {
-                // Conflict REMOVE.
-                val = null;
-                conflictVer = F.first(conflictRmvVals);
-                conflictTtl = CU.TTL_NOT_CHANGED;
-                conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-            }
-            else {
-                // Regular REMOVE.
-                val = null;
-                conflictVer = null;
-                conflictTtl = CU.TTL_NOT_CHANGED;
-                conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-            }
-
-            // We still can get here if user pass map with single element.
-            if (key == null)
-                throw new NullPointerException("Null key.");
-
-            if (val == null && op != GridCacheOperation.DELETE)
-                throw new NullPointerException("Null value.");
-
-            KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
-
-            if (op != TRANSFORM)
-                val = cctx.toCacheObject(val);
-
-            ClusterNode primary = cctx.affinity().primary(cacheKey, topVer);
-
-            if (primary == null)
-                throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
-                    "left the grid).");
-
-            GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
-                cctx.cacheId(),
-                primary.id(),
-                futVer,
-                fastMap,
-                updVer,
-                topVer,
-                topLocked,
-                syncMode,
-                op,
-                retval,
-                expiryPlc,
-                invokeArgs,
-                filter,
-                subjId,
-                taskNameHash,
-                skipStore,
-                keepBinary,
-                cctx.kernalContext().clientNode(),
-                cctx.deploymentEnabled(),
-                1);
-
-            req.addUpdateEntry(cacheKey,
-                val,
-                conflictTtl,
-                conflictExpireTime,
-                conflictVer,
-                true);
-
-            return req;
-        }
-
-        /**
-         * @param ret Result from single node.
-         */
-        @SuppressWarnings("unchecked")
-        private void addInvokeResults(GridCacheReturn ret) {
-            assert op == TRANSFORM : op;
-            assert ret.value() == null || ret.value() instanceof Map : ret.value();
-
-            if (ret.value() != null) {
-                if (opRes != null)
-                    opRes.mergeEntryProcessResults(ret);
-                else
-                    opRes = ret;
-            }
-        }
-
-        /**
-         * @param failedKeys Failed keys.
-         * @param topVer Topology version for failed update.
-         * @param err Error cause.
-         */
-        private void addFailedKeys(Collection<KeyCacheObject> failedKeys,
-            AffinityTopologyVersion topVer,
-            Throwable err) {
-            CachePartialUpdateCheckedException err0 = this.err;
-
-            if (err0 == null)
-                err0 = this.err = new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
-
-            Collection<Object> keys = new ArrayList<>(failedKeys.size());
-
-            for (KeyCacheObject key : failedKeys)
-                keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
-
-            err0.add(keys, err, topVer);
-        }
-
-        /** {@inheritDoc} */
-        @Override public synchronized  String toString() {
-            return S.toString(UpdateState.class, this);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public String toString() {
-        return S.toString(GridNearAtomicSingleUpdateFuture.class, this, super.toString());
-    }
-}


[45/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
Review.


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

Branch: refs/heads/ignite-2523
Commit: f83d909393f019f1a94801c08f287541e2074df2
Parents: 28c20c3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:19:11 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:19:11 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 151 ++++---------------
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  31 +---
 .../atomic/GridNearAtomicUpdateResponse.java    | 113 +++-----------
 3 files changed, 60 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f83d9093/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index c7c940c..4ceac74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -215,7 +215,6 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
 
         keys = new ArrayList<>();
         partIds = new ArrayList<>();
-        locPrevVals = new ArrayList<>();
 
         if (forceTransformBackups) {
             entryProcessors = new ArrayList<>();
@@ -225,23 +224,12 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
             vals = new ArrayList<>();
     }
 
-    /**
-     * @return Force transform backups flag.
-     */
+    /** {@inheritDoc} */
     @Override public boolean forceTransformBackups() {
         return forceTransformBackups;
     }
 
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL (optional).
-     * @param conflictExpireTime Conflict expire time (optional).
-     * @param conflictVer Conflict version (optional).
-     * @param addPrevVal If {@code true} adds previous value.
-     * @param prevVal Previous value.
-     */
+    /** {@inheritDoc} */
     @Override public void addWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,
         EntryProcessor<Object, Object, Object> entryProcessor,
@@ -325,13 +313,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
             conflictExpireTimes.add(conflictExpireTime);
     }
 
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL.
-     * @param expireTime Expire time.
-     */
+    /** {@inheritDoc} */
     @Override public void addNearWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,
         EntryProcessor<Object, Object, Object> entryProcessor,
@@ -388,96 +370,67 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return CACHE_MSG_IDX;
     }
 
-    /**
-     * @return Node ID.
-     */
+    /** {@inheritDoc} */
     @Override public UUID nodeId() {
         return nodeId;
     }
 
-    /**
-     * @return Subject ID.
-     */
+    /** {@inheritDoc} */
     @Override public UUID subjectId() {
         return subjId;
     }
 
-    /**
-     * @return Task name.
-     */
+    /** {@inheritDoc} */
     @Override public int taskNameHash() {
         return taskNameHash;
     }
 
-    /**
-     * @return Keys size.
-     */
+    /** {@inheritDoc} */
     @Override public int size() {
         return keys.size();
     }
 
-    /**
-     * @return Keys size.
-     */
+    /** {@inheritDoc} */
     @Override public int nearSize() {
         return nearKeys != null ? nearKeys.size() : 0;
     }
 
-    /**
-     * @return Version assigned on primary node.
-     */
+    /** {@inheritDoc} */
     @Override public GridCacheVersion futureVersion() {
         return futVer;
     }
 
-    /**
-     * @return Write version.
-     */
+    /** {@inheritDoc} */
     @Override public GridCacheVersion writeVersion() {
         return writeVer;
     }
 
-    /**
-     * @return Cache write synchronization mode.
-     */
+    /** {@inheritDoc} */
     @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
         return syncMode;
     }
 
-    /**
-     * @return Topology version.
-     */
+    /** {@inheritDoc} */
     @Override public AffinityTopologyVersion topologyVersion() {
         return topVer;
     }
 
-    /**
-     * @return Keys.
-     */
+    /** {@inheritDoc} */
     @Override public Collection<KeyCacheObject> keys() {
         return keys;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Key.
-     */
+    /** {@inheritDoc} */
     @Override public KeyCacheObject key(int idx) {
         return keys.get(idx);
     }
 
-    /**
-     * @param idx Partition index.
-     * @return Partition id.
-     */
+    /** {@inheritDoc} */
     @Override public int partitionId(int idx) {
         return partIds.get(idx);
     }
 
-    /**
-     * @param updCntr Update counter.
-     * @return Update counter.
-     */
+    /** {@inheritDoc} */
     @Override public Long updateCounter(int updCntr) {
         if (updateCntrs != null && updCntr < updateCntrs.size())
             return updateCntrs.get(updCntr);
@@ -485,25 +438,17 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return null;
     }
 
-    /**
-     * @param idx Near key index.
-     * @return Key.
-     */
+    /** {@inheritDoc} */
     @Override public KeyCacheObject nearKey(int idx) {
         return nearKeys.get(idx);
     }
 
-    /**
-     * @return Keep binary flag.
-     */
+    /** {@inheritDoc} */
     @Override public boolean keepBinary() {
         return keepBinary;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public CacheObject value(int idx) {
         if (vals != null)
             return vals.get(idx);
@@ -511,10 +456,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return null;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public CacheObject previousValue(int idx) {
         if (prevVals != null)
             return prevVals.get(idx);
@@ -522,28 +464,19 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return null;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public CacheObject localPreviousValue(int idx) {
         assert locPrevVals != null;
 
         return locPrevVals.get(idx);
     }
 
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
         return entryProcessors == null ? null : entryProcessors.get(idx);
     }
 
-    /**
-     * @param idx Near key index.
-     * @return Value.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public CacheObject nearValue(int idx) {
         if (nearVals != null)
             return nearVals.get(idx);
@@ -551,18 +484,12 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return null;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Transform closure.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
         return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
         if (conflictVers != null) {
             assert idx >= 0 && idx < conflictVers.size();
@@ -573,10 +500,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return null;
     }
 
-    /**
-     * @param idx Index.
-     * @return TTL.
-     */
+    /** {@inheritDoc} */
     @Override public long ttl(int idx) {
         if (ttls != null) {
             assert idx >= 0 && idx < ttls.size();
@@ -587,10 +511,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return CU.TTL_NOT_CHANGED;
     }
 
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public long nearTtl(int idx) {
         if (nearTtls != null) {
             assert idx >= 0 && idx < nearTtls.size();
@@ -601,10 +522,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return CU.TTL_NOT_CHANGED;
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
+    /** {@inheritDoc} */
     @Override public long conflictExpireTime(int idx) {
         if (conflictExpireTimes != null) {
             assert idx >= 0 && idx < conflictExpireTimes.size();
@@ -615,10 +533,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return CU.EXPIRE_TIME_CALCULATE;
     }
 
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public long nearExpireTime(int idx) {
         if (nearExpireTimes != null) {
             assert idx >= 0 && idx < nearExpireTimes.size();
@@ -629,16 +544,12 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         return CU.EXPIRE_TIME_CALCULATE;
     }
 
-    /**
-     * @return {@code True} if on response flag changed.
-     */
+    /** {@inheritDoc} */
     @Override public boolean onResponse() {
         return !onRes && (onRes = true);
     }
 
-    /**
-     * @return Optional arguments for entry processor.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public Object[] invokeArguments() {
         return invokeArgs;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f83d9093/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 74cdc6e..a8d0169 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -91,18 +91,12 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
         return CACHE_MSG_IDX;
     }
 
-    /**
-     * @return Future version.
-     */
+    /** {@inheritDoc} */
     @Override public GridCacheVersion futureVersion() {
         return futVer;
     }
 
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
+    /** {@inheritDoc} */
     @Override public void onError(IgniteCheckedException err) {
         this.err = err;
     }
@@ -112,19 +106,12 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
         return err;
     }
 
-    /**
-     * @return Failed keys.
-     */
+    /** {@inheritDoc} */
     @Override public Collection<KeyCacheObject> failedKeys() {
         return failedKeys;
     }
 
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
+    /** {@inheritDoc} */
     @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
         if (failedKeys == null)
             failedKeys = new ArrayList<>();
@@ -137,18 +124,12 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
         err.addSuppressed(e);
     }
 
-    /**
-     * @return Evicted readers.
-     */
+    /** {@inheritDoc} */
     @Override public Collection<KeyCacheObject> nearEvicted() {
         return nearEvicted;
     }
 
-    /**
-     * Adds near evicted key..
-     *
-     * @param key Evicted key.
-     */
+    /** {@inheritDoc} */
     @Override public void addNearEvicted(KeyCacheObject key) {
         if (nearEvicted == null)
             nearEvicted = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f83d9093/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 2295854..84a4a9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -131,32 +131,22 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         return CACHE_MSG_IDX;
     }
 
-    /**
-     * @return Node ID this response should be sent to.
-     */
+    /** {@inheritDoc} */
     @Override public UUID nodeId() {
         return nodeId;
     }
 
-    /**
-     * @param nodeId Node ID.
-     */
+    /** {@inheritDoc} */
     @Override public void nodeId(UUID nodeId) {
         this.nodeId = nodeId;
     }
 
-    /**
-     * @return Future version.
-     */
+    /** {@inheritDoc} */
     @Override public GridCacheVersion futureVersion() {
         return futVer;
     }
 
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
+    /** {@inheritDoc} */
     @Override public void error(IgniteCheckedException err) {
         this.err = err;
     }
@@ -166,50 +156,33 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         return err;
     }
 
-    /**
-     * @return Collection of failed keys.
-     */
+    /** {@inheritDoc} */
     @Override public Collection<KeyCacheObject> failedKeys() {
         return failedKeys;
     }
 
-    /**
-     * @return Return value.
-     */
+    /** {@inheritDoc} */
     @Override public GridCacheReturn returnValue() {
         return ret;
     }
 
-    /**
-     * @param ret Return value.
-     */
+    /** {@inheritDoc} */
     @Override @SuppressWarnings("unchecked")
     public void returnValue(GridCacheReturn ret) {
         this.ret = ret;
     }
 
-    /**
-     * @param remapKeys Remap keys.
-     */
+    /** {@inheritDoc} */
     @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
         this.remapKeys = remapKeys;
     }
 
-    /**
-     * @return Remap keys.
-     */
+    /** {@inheritDoc} */
     @Override public Collection<KeyCacheObject> remapKeys() {
         return remapKeys;
     }
 
-    /**
-     * Adds value to be put in near cache on originating node.
-     *
-     * @param keyIdx Key index.
-     * @param val Value.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public void addNearValue(int keyIdx,
         @Nullable CacheObject val,
         long ttl,
@@ -225,11 +198,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         nearVals.add(val);
     }
 
-    /**
-     * @param keyIdx Key index.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
+    /** {@inheritDoc} */
     @Override @SuppressWarnings("ForLoopReplaceableByForEach")
     public void addNearTtl(int keyIdx, long ttl, long expireTime) {
         if (ttl >= 0) {
@@ -257,10 +226,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
             nearExpireTimes.add(expireTime);
     }
 
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public long nearExpireTime(int idx) {
         if (nearExpireTimes != null) {
             assert idx >= 0 && idx < nearExpireTimes.size();
@@ -271,10 +237,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         return -1L;
     }
 
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public long nearTtl(int idx) {
         if (nearTtls != null) {
             assert idx >= 0 && idx < nearTtls.size();
@@ -285,23 +248,17 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         return -1L;
     }
 
-    /**
-     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public void nearVersion(GridCacheVersion nearVer) {
         this.nearVer = nearVer;
     }
 
-    /**
-     * @return Version generated on primary node to be used for originating node's near cache update.
-     */
+    /** {@inheritDoc} */
     @Override public GridCacheVersion nearVersion() {
         return nearVer;
     }
 
-    /**
-     * @param keyIdx Index of key for which update was skipped
-     */
+    /** {@inheritDoc} */
     @Override public void addSkippedIndex(int keyIdx) {
         if (nearSkipIdxs == null)
             nearSkipIdxs = new ArrayList<>();
@@ -311,34 +268,22 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         addNearTtl(keyIdx, -1L, -1L);
     }
 
-    /**
-     * @return Indexes of keys for which update was skipped
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public List<Integer> skippedIndexes() {
         return nearSkipIdxs;
     }
 
-    /**
-     * @return Indexes of keys for which values were generated on primary node.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public List<Integer> nearValuesIndexes() {
         return nearValsIdxs;
     }
 
-    /**
-     * @param idx Index.
-     * @return Value generated on primary node which should be put to originating node's near cache.
-     */
+    /** {@inheritDoc} */
     @Override @Nullable public CacheObject nearValue(int idx) {
         return nearVals.get(idx);
     }
 
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
+    /** {@inheritDoc} */
     @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
         if (failedKeys == null)
             failedKeys = new ConcurrentLinkedQueue<>();
@@ -351,12 +296,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         err.addSuppressed(e);
     }
 
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     */
+    /** {@inheritDoc} */
     @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
         if (keys != null) {
             if (failedKeys == null)
@@ -371,13 +311,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         err.addSuppressed(e);
     }
 
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     * @param ctx Context.
-     */
+    /** {@inheritDoc} */
     @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
         GridCacheContext ctx) {
         if (failedKeys == null)
@@ -391,8 +325,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         err.addSuppressed(e);
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
+    /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 


[11/51] [abbrv] ignite git commit: IGNITE-2523: Fixed IgniteCacheAtomicStopBusySelfTest.

Posted by vo...@apache.org.
IGNITE-2523: Fixed IgniteCacheAtomicStopBusySelfTest.


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

Branch: refs/heads/ignite-2523
Commit: 0128f988c60cdbd9aec6996626b6ffb1ad1fa30e
Parents: d3e1645
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 4 10:54:25 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 4 10:54:25 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheAtomicStopBusySelfTest.java     | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0128f988/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index cdb7907..024ff2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 
 /**
@@ -32,6 +33,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
     /** {@inheritDoc} */
     @Override public void testPut() throws Exception {
         bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
     }
@@ -39,6 +41,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
     /** {@inheritDoc} */
     @Override public void testPutBatch() throws Exception {
         bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
     }
@@ -46,6 +49,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
     /** {@inheritDoc} */
     @Override public void testPutAsync() throws Exception {
         bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
     }
@@ -53,6 +57,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
     /** {@inheritDoc} */
     @Override public void testRemove() throws Exception {
         bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
     }


[20/51] [abbrv] ignite git commit: ignite-2523 : Created SingleUpdateResponse

Posted by vo...@apache.org.
ignite-2523 : Created SingleUpdateResponse


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

Branch: refs/heads/ignite-2523
Commit: dfdd2f4f907651a86da6fd52f18d2f189f65279d
Parents: a18c352
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Mon Feb 8 17:23:02 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Mon Feb 8 17:23:02 2016 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |  10 +-
 .../processors/cache/GridCacheIoManager.java    |  10 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  38 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |   8 +-
 .../GridNearAtomicMultipleUpdateRequest.java    |   6 +-
 .../GridNearAtomicMultipleUpdateResponse.java   | 640 ++++++++++++++++++
 .../GridNearAtomicSingleUpdateRequest.java      |   6 +-
 .../GridNearAtomicSingleUpdateResponse.java     | 641 +++++++++++++++++++
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  22 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |   4 +-
 .../atomic/GridNearAtomicUpdateResponse.java    | 616 ++----------------
 .../distributed/near/GridNearAtomicCache.java   |   4 +-
 .../IgniteClientReconnectCacheTest.java         |   4 +-
 .../IgniteClientReconnectCollectionsTest.java   |   6 +-
 14 files changed, 1382 insertions(+), 633 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 88e34c9..4d769af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -68,9 +68,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlock
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
@@ -368,7 +369,7 @@ public class GridIoMessageFactory implements MessageFactory {
                 break;
 
             case 41:
-                msg = new GridNearAtomicUpdateResponse();
+                msg = new GridNearAtomicMultipleUpdateResponse();
 
                 break;
 
@@ -732,6 +733,11 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
+            case -24:
+                msg = new GridNearAtomicSingleUpdateResponse();
+
+                break;
+
             // [-3..119] [124] - this
             // [120..123] - DR
             // [-4..-22] - SQL

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 8a8f161..ea97277 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -46,7 +46,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDh
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest;
@@ -412,7 +412,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             case 40: {
                 GridNearAtomicMultipleUpdateRequest req = (GridNearAtomicMultipleUpdateRequest)msg;
 
-                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(
                     ctx.cacheId(),
                     nodeId,
                     req.futureVersion(),
@@ -443,7 +443,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 45: {
-                processMessage(nodeId,msg,c);// Will be handled by Rebalance Demander.
+                processMessage(nodeId, msg, c);// Will be handled by Rebalance Demander.
             }
 
             break;
@@ -544,7 +544,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 114: {
-                processMessage(nodeId,msg,c);// Will be handled by Rebalance Demander.
+                processMessage(nodeId, msg, c);// Will be handled by Rebalance Demander.
             }
 
             break;
@@ -590,7 +590,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             case -23: {
                 GridNearAtomicSingleUpdateRequest req = (GridNearAtomicSingleUpdateRequest)msg;
 
-                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(
                     ctx.cacheId(),
                     nodeId,
                     req.futureVersion(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 55db70a..b0504db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -139,7 +139,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Integer.getInteger(IGNITE_ATOMIC_DEFERRED_ACK_TIMEOUT, 500);
 
     /** Update reply closure. */
-    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
+    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> updateReplyClos;
 
     /** Pending  */
     private ConcurrentMap<UUID, DeferredResponseBuffer> pendingResponses = new ConcurrentHashMap8<>();
@@ -192,9 +192,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicMultipleUpdateResponse res) {
                 if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
                     assert req.writeSynchronizationMode() != FULL_ASYNC : req;
 
@@ -262,8 +262,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateResponse.class, new CI2<UUID, GridNearAtomicUpdateResponse>() {
-            @Override public void apply(UUID nodeId, GridNearAtomicUpdateResponse res) {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateResponse.class, new CI2<UUID, GridNearAtomicMultipleUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
                 processNearAtomicUpdateResponse(nodeId, res);
             }
         });
@@ -1311,7 +1311,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     public void updateAllAsyncInternal(
         final UUID nodeId,
         final GridNearAtomicUpdateRequest req,
-        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb
     ) {
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
@@ -1336,9 +1336,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     public void updateAllAsyncInternal0(
         UUID nodeId,
         GridNearAtomicUpdateRequest req,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb
     ) {
-        GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
+        GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
             ctx.deploymentEnabled());
 
         List<KeyCacheObject> keys = req.keys();
@@ -1559,11 +1559,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         ClusterNode node,
         boolean hasNear,
         GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res,
+        GridNearAtomicMultipleUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -1975,11 +1975,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         ClusterNode node,
         boolean hasNear,
         GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res,
+        GridNearAtomicMultipleUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2214,9 +2214,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable Collection<KeyCacheObject> rmvKeys,
         @Nullable Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
         final GridNearAtomicUpdateRequest req,
-        final GridNearAtomicUpdateResponse res,
+        final GridNearAtomicMultipleUpdateResponse res,
         boolean replicate,
         UpdateBatchResult batchRes,
         String taskName,
@@ -2594,7 +2594,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @return {@code True} if filter evaluation succeeded.
      */
     private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res) {
+        GridNearAtomicMultipleUpdateResponse res) {
         try {
             return ctx.isAllLocked(entry, req.filter());
         }
@@ -2688,8 +2688,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
         GridCacheVersion writeVer,
         GridNearAtomicUpdateRequest updateReq,
-        GridNearAtomicUpdateResponse updateRes,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        GridNearAtomicMultipleUpdateResponse updateRes,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
         boolean force
     ) {
         if (!force) {
@@ -2734,7 +2734,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param res Near atomic update response.
      */
     @SuppressWarnings("unchecked")
-    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponse res) {
+    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
 
@@ -2944,7 +2944,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Originating node ID.
      * @param res Near update response.
      */
-    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) {
+    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
         try {
             ctx.io().send(nodeId, res, ctx.ioPolicy());
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 3a31700..68c639d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -77,7 +77,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
 
     /** Completion callback. */
     @GridToStringExclude
-    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
+    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb;
 
     /** Mappings. */
     @GridToStringInclude
@@ -90,7 +90,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
     private final GridNearAtomicUpdateRequest updateReq;
 
     /** Update response. */
-    private final GridNearAtomicUpdateResponse updateRes;
+    private final GridNearAtomicMultipleUpdateResponse updateRes;
 
     /** Future keys. */
     private final Collection<KeyCacheObject> keys;
@@ -110,10 +110,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public GridDhtAtomicUpdateFuture(
         GridCacheContext cctx,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
         GridCacheVersion writeVer,
         GridNearAtomicUpdateRequest updateReq,
-        GridNearAtomicUpdateResponse updateRes
+        GridNearAtomicMultipleUpdateResponse updateRes
     ) {
         this.cctx = cctx;
         this.writeVer = writeVer;

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index 650d350..6f109be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -157,7 +157,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicUpdateResponse res;
+    private GridNearAtomicMultipleUpdateResponse res;
 
     /** Maximum possible size of inner collections. */
     @GridDirectTransient
@@ -502,7 +502,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+    @Override public boolean onResponse(GridNearAtomicMultipleUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -513,7 +513,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponse response() {
+    @Override @Nullable public GridNearAtomicMultipleUpdateResponse response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
new file mode 100644
index 0000000..d22acc4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -0,0 +1,640 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * DHT atomic cache near update response.
+ */
+public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID this reply should be sent to. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Update error. */
+    @GridDirectTransient
+    private volatile IgniteCheckedException err;
+
+    /** Serialized error. */
+    private byte[] errBytes;
+
+    /** Return value. */
+    @GridToStringInclude
+    private GridCacheReturn ret;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private volatile Collection<KeyCacheObject> failedKeys;
+
+    /** Keys that should be remapped. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> remapKeys;
+
+    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearValsIdxs;
+
+    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearSkipIdxs;
+
+    /** Values generated on primary node which should be put to originating node's near cache. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Version generated on primary node to be used for originating node's near cache update. */
+    private GridCacheVersion nearVer;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicMultipleUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID this reply should be sent to.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info flag.
+     */
+    public GridNearAtomicMultipleUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Node ID this response should be sent to.
+     */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @param nodeId Node ID.
+     */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /**
+     * @return Future version.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    @Override public void error(IgniteCheckedException err){
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /**
+     * @return Collection of failed keys.
+     */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /**
+     * @return Return value.
+     */
+    @Override public GridCacheReturn returnValue() {
+        return ret;
+    }
+
+    /**
+     * @param ret Return value.
+     */
+    @Override @SuppressWarnings("unchecked")
+    public void returnValue(GridCacheReturn ret) {
+        this.ret = ret;
+    }
+
+    /**
+     * @param remapKeys Remap keys.
+     */
+    @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
+        this.remapKeys = remapKeys;
+    }
+
+    /**
+     * @return Remap keys.
+     */
+    @Override public Collection<KeyCacheObject> remapKeys() {
+        return remapKeys;
+    }
+
+    /**
+     * Adds value to be put in near cache on originating node.
+     *
+     * @param keyIdx Key index.
+     * @param val Value.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @Override public void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime) {
+        if (nearValsIdxs == null) {
+            nearValsIdxs = new ArrayList<>();
+            nearVals = new ArrayList<>();
+        }
+
+        addNearTtl(keyIdx, ttl, expireTime);
+
+        nearValsIdxs.add(keyIdx);
+        nearVals.add(val);
+    }
+
+    /**
+     * @param keyIdx Key index.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @Override @SuppressWarnings("ForLoopReplaceableByForEach")
+    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearTtls.add(-1L);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearExpireTimes.add(-1);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /**
+     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+     */
+    @Override public void nearVersion(GridCacheVersion nearVer) {
+        this.nearVer = nearVer;
+    }
+
+    /**
+     * @return Version generated on primary node to be used for originating node's near cache update.
+     */
+    @Override public GridCacheVersion nearVersion() {
+        return nearVer;
+    }
+
+    /**
+     * @param keyIdx Index of key for which update was skipped
+     */
+    @Override public void addSkippedIndex(int keyIdx) {
+        if (nearSkipIdxs == null)
+            nearSkipIdxs = new ArrayList<>();
+
+        nearSkipIdxs.add(keyIdx);
+
+        addNearTtl(keyIdx, -1L, -1L);
+    }
+
+    /**
+     * @return Indexes of keys for which update was skipped
+     */
+    @Override @Nullable public List<Integer> skippedIndexes() {
+        return nearSkipIdxs;
+    }
+
+    /**
+     * @return Indexes of keys for which values were generated on primary node.
+     */
+   @Override @Nullable public List<Integer> nearValuesIndexes() {
+        return nearValsIdxs;
+   }
+
+    /**
+     * @param idx Index.
+     * @return Value generated on primary node which should be put to originating node's near cache.
+     */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        return nearVals.get(idx);
+    }
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ConcurrentLinkedQueue<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
+        if (keys != null) {
+            if (failedKeys == null)
+                failedKeys = new ArrayList<>(keys.size());
+
+            failedKeys.addAll(keys);
+        }
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     * @param ctx Context.
+     */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>(keys.size());
+
+        failedKeys.addAll(keys);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc}
+     * @param ctx*/
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        if (err != null && errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(remapKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        if (ret != null)
+            ret.prepareMarshal(cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        if (ret != null)
+            ret.finishUnmarshal(cctx, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("nearVer", nearVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeMessage("ret", ret))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearVer = reader.readMessage("nearVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                ret = reader.readMessage("ret");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicMultipleUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 41;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 14;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicMultipleUpdateResponse.class, this, "parent");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/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 1e981af..8714010 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
@@ -149,7 +149,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicUpdateResponse res;
+    private GridNearAtomicMultipleUpdateResponse res;
 
     /**
      * Empty constructor required by {@link Externalizable}.
@@ -427,7 +427,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+    @Override public boolean onResponse(GridNearAtomicMultipleUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -438,7 +438,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponse response() {
+    @Override @Nullable public GridNearAtomicMultipleUpdateResponse response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
new file mode 100644
index 0000000..581c33b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -0,0 +1,641 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
+
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID this reply should be sent to. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Update error. */
+    @GridDirectTransient
+    private volatile IgniteCheckedException err;
+
+    /** Serialized error. */
+    private byte[] errBytes;
+
+    /** Return value. */
+    @GridToStringInclude
+    private GridCacheReturn ret;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private volatile Collection<KeyCacheObject> failedKeys;
+
+    /** Keys that should be remapped. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> remapKeys;
+
+    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearValsIdxs;
+
+    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearSkipIdxs;
+
+    /** Values generated on primary node which should be put to originating node's near cache. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Version generated on primary node to be used for originating node's near cache update. */
+    private GridCacheVersion nearVer;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicSingleUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID this reply should be sent to.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info flag.
+     */
+    public GridNearAtomicSingleUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Node ID this response should be sent to.
+     */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @param nodeId Node ID.
+     */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /**
+     * @return Future version.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    @Override public void error(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /**
+     * @return Collection of failed keys.
+     */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /**
+     * @return Return value.
+     */
+    @Override public GridCacheReturn returnValue() {
+        return ret;
+    }
+
+    /**
+     * @param ret Return value.
+     */
+    @Override @SuppressWarnings("unchecked")
+    public void returnValue(GridCacheReturn ret) {
+        this.ret = ret;
+    }
+
+    /**
+     * @param remapKeys Remap keys.
+     */
+    @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
+        this.remapKeys = remapKeys;
+    }
+
+    /**
+     * @return Remap keys.
+     */
+    @Override public Collection<KeyCacheObject> remapKeys() {
+        return remapKeys;
+    }
+
+    /**
+     * Adds value to be put in near cache on originating node.
+     *
+     * @param keyIdx Key index.
+     * @param val Value.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @Override public void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime) {
+        if (nearValsIdxs == null) {
+            nearValsIdxs = new ArrayList<>();
+            nearVals = new ArrayList<>();
+        }
+
+        addNearTtl(keyIdx, ttl, expireTime);
+
+        nearValsIdxs.add(keyIdx);
+        nearVals.add(val);
+    }
+
+    /**
+     * @param keyIdx Key index.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @Override @SuppressWarnings("ForLoopReplaceableByForEach")
+    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearTtls.add(-1L);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearExpireTimes.add(-1);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /**
+     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+     */
+    @Override public void nearVersion(GridCacheVersion nearVer) {
+        this.nearVer = nearVer;
+    }
+
+    /**
+     * @return Version generated on primary node to be used for originating node's near cache update.
+     */
+    @Override public GridCacheVersion nearVersion() {
+        return nearVer;
+    }
+
+    /**
+     * @param keyIdx Index of key for which update was skipped
+     */
+    @Override public void addSkippedIndex(int keyIdx) {
+        if (nearSkipIdxs == null)
+            nearSkipIdxs = new ArrayList<>();
+
+        nearSkipIdxs.add(keyIdx);
+
+        addNearTtl(keyIdx, -1L, -1L);
+    }
+
+    /**
+     * @return Indexes of keys for which update was skipped
+     */
+    @Override @Nullable public List<Integer> skippedIndexes() {
+        return nearSkipIdxs;
+    }
+
+    /**
+     * @return Indexes of keys for which values were generated on primary node.
+     */
+    @Override @Nullable public List<Integer> nearValuesIndexes() {
+        return nearValsIdxs;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Value generated on primary node which should be put to originating node's near cache.
+     */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        return nearVals.get(idx);
+    }
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ConcurrentLinkedQueue<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
+        if (keys != null) {
+            if (failedKeys == null)
+                failedKeys = new ArrayList<>(keys.size());
+
+            failedKeys.addAll(keys);
+        }
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     * @param ctx Context.
+     */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
+        GridCacheContext ctx) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>(keys.size());
+
+        failedKeys.addAll(keys);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc}
+     * @param ctx*/
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        if (err != null && errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(remapKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        if (ret != null)
+            ret.prepareMarshal(cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        if (ret != null)
+            ret.finishUnmarshal(cctx, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("nearVer", nearVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeMessage("ret", ret))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearVer = reader.readMessage("nearVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                ret = reader.readMessage("ret");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicMultipleUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return -24;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 14;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicSingleUpdateResponse.class, this, "parent");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/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 c1dab93..68ee67b 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
@@ -339,7 +339,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param res Update response.
      */
-    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
+    public void onResult(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
         state.onResult(nodeId, res, false);
     }
 
@@ -349,7 +349,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param req Update request.
      * @param res Update response.
      */
-    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicMultipleUpdateResponse res) {
         assert nearEnabled;
 
         if (res.remapKeys() != null || !req.hasPrimary())
@@ -454,9 +454,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
     private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
                     @Override public void apply(GridNearAtomicUpdateRequest req,
-                        GridNearAtomicUpdateResponse res) {
+                        GridNearAtomicMultipleUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -510,8 +510,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
-                new CI2<GridNearAtomicMultipleUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicMultipleUpdateRequest req, GridNearAtomicUpdateResponse res) {
+                new CI2<GridNearAtomicMultipleUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicMultipleUpdateRequest req, GridNearAtomicMultipleUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -570,7 +570,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeId Left node ID.
          */
         void onNodeLeft(UUID nodeId) {
-            GridNearAtomicUpdateResponse res = null;
+            GridNearAtomicMultipleUpdateResponse res = null;
 
             synchronized (this) {
                 GridNearAtomicUpdateRequest req;
@@ -581,7 +581,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     req = mappings != null ? mappings.get(nodeId) : null;
 
                 if (req != null && req.response() == null) {
-                    res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                    res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
                         nodeId,
                         req.futureVersion(),
                         cctx.deploymentEnabled());
@@ -605,7 +605,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeErr {@code True} if response was created on node failure.
          */
         @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
-        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
+        void onResult(UUID nodeId, GridNearAtomicMultipleUpdateResponse res, boolean nodeErr) {
             GridNearAtomicUpdateRequest req;
 
             AffinityTopologyVersion remapTopVer = null;
@@ -737,7 +737,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
                     for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
-                        GridNearAtomicUpdateResponse res0 = req0.response();
+                        GridNearAtomicMultipleUpdateResponse res0 = req0.response();
 
                         assert res0 != null : req0;
 
@@ -812,7 +812,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          */
         void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
             synchronized (this) {
-                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
                     req.nodeId(),
                     req.futureVersion(),
                     cctx.deploymentEnabled());

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 960add7..c1977bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -190,10 +190,10 @@ public interface GridNearAtomicUpdateRequest {
      * @param res Response.
      * @return {@code True} if current response was {@code null}.
      */
-    public boolean onResponse(GridNearAtomicUpdateResponse res);
+    public boolean onResponse(GridNearAtomicMultipleUpdateResponse res);
 
     /**
      * @return Response.
      */
-    @Nullable public GridNearAtomicUpdateResponse response();
+    @Nullable public GridNearAtomicMultipleUpdateResponse response();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 3e3ac29..51d388c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -17,624 +17,86 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
 
-/**
- * DHT atomic cache near update response.
- */
-public class GridNearAtomicUpdateResponse extends GridCacheMessage implements GridCacheDeployable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Cache message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Node ID this reply should be sent to. */
-    @GridDirectTransient
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Update error. */
-    @GridDirectTransient
-    private volatile IgniteCheckedException err;
-
-    /** Serialized error. */
-    private byte[] errBytes;
-
-    /** Return value. */
-    @GridToStringInclude
-    private GridCacheReturn ret;
-
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private volatile Collection<KeyCacheObject> failedKeys;
-
-    /** Keys that should be remapped. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> remapKeys;
-
-    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearValsIdxs;
-
-    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearSkipIdxs;
-
-    /** Values generated on primary node which should be put to originating node's near cache. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
-    /** Version generated on primary node to be used for originating node's near cache update. */
-    private GridCacheVersion nearVer;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridNearAtomicUpdateResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID this reply should be sent to.
-     * @param futVer Future version.
-     * @param addDepInfo Deployment info flag.
-     */
-    public GridNearAtomicUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
-        assert futVer != null;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.addDepInfo = addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /**
-     * @return Node ID this response should be sent to.
-     */
-    public UUID nodeId() {
-        return nodeId;
-    }
-
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    public void error(IgniteCheckedException err){
-        this.err = err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteCheckedException error() {
-        return err;
-    }
-
-    /**
-     * @return Collection of failed keys.
-     */
-    public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
-    }
-
-    /**
-     * @return Return value.
-     */
-    public GridCacheReturn returnValue() {
-        return ret;
-    }
-
-    /**
-     * @param ret Return value.
-     */
-    @SuppressWarnings("unchecked")
-    public void returnValue(GridCacheReturn ret) {
-        this.ret = ret;
-    }
-
-    /**
-     * @param remapKeys Remap keys.
-     */
-    public void remapKeys(List<KeyCacheObject> remapKeys) {
-        this.remapKeys = remapKeys;
-    }
-
-    /**
-     * @return Remap keys.
-     */
-    public Collection<KeyCacheObject> remapKeys() {
-        return remapKeys;
-    }
-
-    /**
-     * Adds value to be put in near cache on originating node.
-     *
-     * @param keyIdx Key index.
-     * @param val Value.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    public void addNearValue(int keyIdx,
-        @Nullable CacheObject val,
-        long ttl,
-        long expireTime) {
-        if (nearValsIdxs == null) {
-            nearValsIdxs = new ArrayList<>();
-            nearVals = new ArrayList<>();
-        }
-
-        addNearTtl(keyIdx, ttl, expireTime);
-
-        nearValsIdxs.add(keyIdx);
-        nearVals.add(val);
-    }
-
-    /**
-     * @param keyIdx Key index.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    @SuppressWarnings("ForLoopReplaceableByForEach")
-    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearTtls.add(-1L);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
-
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearExpireTimes.add(-1);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
-    }
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
-
-        return -1L;
-    }
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
-
-        return -1L;
-    }
-
-    /**
-     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
-     */
-    public void nearVersion(GridCacheVersion nearVer) {
-        this.nearVer = nearVer;
-    }
-
-    /**
-     * @return Version generated on primary node to be used for originating node's near cache update.
-     */
-    public GridCacheVersion nearVersion() {
-        return nearVer;
-    }
-
-    /**
-     * @param keyIdx Index of key for which update was skipped
-     */
-    public void addSkippedIndex(int keyIdx) {
-        if (nearSkipIdxs == null)
-            nearSkipIdxs = new ArrayList<>();
-
-        nearSkipIdxs.add(keyIdx);
-
-        addNearTtl(keyIdx, -1L, -1L);
-    }
-
-    /**
-     * @return Indexes of keys for which update was skipped
-     */
-    @Nullable public List<Integer> skippedIndexes() {
-        return nearSkipIdxs;
-    }
-
-    /**
-     * @return Indexes of keys for which values were generated on primary node.
-     */
-   @Nullable public List<Integer> nearValuesIndexes() {
-        return nearValsIdxs;
-   }
-
-    /**
-     * @param idx Index.
-     * @return Value generated on primary node which should be put to originating node's near cache.
-     */
-    @Nullable public CacheObject nearValue(int idx) {
-        return nearVals.get(idx);
-    }
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ConcurrentLinkedQueue<>();
-
-        failedKeys.add(key);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     */
-    public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
-        if (keys != null) {
-            if (failedKeys == null)
-                failedKeys = new ArrayList<>(keys.size());
-
-            failedKeys.addAll(keys);
-        }
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     * @param ctx Context.
-     */
-    public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>(keys.size());
-
-        failedKeys.addAll(keys);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /** {@inheritDoc}
-     * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        if (err != null && errBytes == null)
-            errBytes = ctx.marshaller().marshal(err);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(failedKeys, cctx);
-
-        prepareMarshalCacheObjects(remapKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
-
-        if (ret != null)
-            ret.prepareMarshal(cctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
-
-        if (ret != null)
-            ret.finishUnmarshal(cctx, ldr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeByteArray("errBytes", errBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeMessage("nearTtls", nearTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeMessage("nearVer", nearVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeMessage("ret", ret))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                errBytes = reader.readByteArray("errBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
 
-            case 5:
-                futVer = reader.readMessage("futVer");
+public interface GridNearAtomicUpdateResponse {
 
-                if (!reader.isLastRead())
-                    return false;
+    int lookupIndex();
 
-                reader.incrementState();
+    UUID nodeId();
 
-            case 6:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
+    void nodeId(UUID nodeId);
 
-                if (!reader.isLastRead())
-                    return false;
+    GridCacheVersion futureVersion();
 
-                reader.incrementState();
+    void error(IgniteCheckedException err);
 
-            case 7:
-                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
+    IgniteCheckedException error();
 
-                if (!reader.isLastRead())
-                    return false;
+    Collection<KeyCacheObject> failedKeys();
 
-                reader.incrementState();
+    GridCacheReturn returnValue();
 
-            case 8:
-                nearTtls = reader.readMessage("nearTtls");
+    @SuppressWarnings("unchecked") void returnValue(GridCacheReturn ret);
 
-                if (!reader.isLastRead())
-                    return false;
+    void remapKeys(List<KeyCacheObject> remapKeys);
 
-                reader.incrementState();
+    Collection<KeyCacheObject> remapKeys();
 
-            case 9:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+    void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime);
 
-                if (!reader.isLastRead())
-                    return false;
+    @SuppressWarnings("ForLoopReplaceableByForEach") void addNearTtl(int keyIdx, long ttl, long expireTime);
 
-                reader.incrementState();
+    long nearExpireTime(int idx);
 
-            case 10:
-                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
+    long nearTtl(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    void nearVersion(GridCacheVersion nearVer);
 
-                reader.incrementState();
+    GridCacheVersion nearVersion();
 
-            case 11:
-                nearVer = reader.readMessage("nearVer");
+    void addSkippedIndex(int keyIdx);
 
-                if (!reader.isLastRead())
-                    return false;
+    @Nullable List<Integer> skippedIndexes();
 
-                reader.incrementState();
+    @Nullable List<Integer> nearValuesIndexes();
 
-            case 12:
-                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
+    @Nullable CacheObject nearValue(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    void addFailedKey(KeyCacheObject key, Throwable e);
 
-                reader.incrementState();
+    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e);
 
-            case 13:
-                ret = reader.readMessage("ret");
+    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx);
 
-                if (!reader.isLastRead())
-                    return false;
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
 
-                reader.incrementState();
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
 
-        }
+    boolean addDeploymentInfo();
 
-        return reader.afterMessageRead(GridNearAtomicUpdateResponse.class);
-    }
+    boolean writeTo(ByteBuffer buf, MessageWriter writer);
 
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 41;
-    }
+    boolean readFrom(ByteBuffer buf, MessageReader reader);
 
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 14;
-    }
+    byte directType();
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearAtomicUpdateResponse.class, this, "parent");
-    }
+    byte fieldsCount();
 }


[09/51] [abbrv] ignite git commit: Merge branch 'master' into ignite-2523

Posted by vo...@apache.org.
Merge branch 'master' into ignite-2523


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

Branch: refs/heads/ignite-2523
Commit: 3d34e50c9ece0d12e35a0ff6130659cfa03bdddf
Parents: 3967130 10a2b7a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 4 10:44:33 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 4 10:44:33 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 100 ++++++++++++++++++-
 .../processors/cache/GridCacheMapEntry.java     |   4 +-
 .../cache/GridCacheUpdateAtomicResult.java      |   4 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |   2 +-
 .../org/apache/ignite/spark/IgniteContext.scala |  11 +-
 .../ignite/internal/GridFactorySelfTest.java    |   2 +-
 6 files changed, 110 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3d34e50c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------


[26/51] [abbrv] ignite git commit: ignite-2523 : Fixed test failures.

Posted by vo...@apache.org.
ignite-2523 : Fixed test failures.


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

Branch: refs/heads/ignite-2523
Commit: 6040f45eae844fd40c113de452e70078dae9a95c
Parents: 2f6aff8
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Feb 9 16:14:57 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Tue Feb 9 16:14:57 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridNearAtomicSingleUpdateRequest.java            | 2 --
 .../dht/atomic/GridNearAtomicSingleUpdateResponse.java           | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6040f45e/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 e69be07..1e981af 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
@@ -213,8 +213,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         boolean clientReq,
         boolean addDepInfo
     ) {
-        System.out.println("???");
-
         assert futVer != null;
 
         this.key = key;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6040f45e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index 65dc08e..b3f7e74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -291,7 +291,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @return Indexes of keys for which update was skipped
      */
     @Override @Nullable public List<Integer> skippedIndexes() {
-        if (nearSkip && key != null)
+        if (nearSkip)
             return Collections.singletonList(0);
 
         return null;
@@ -301,7 +301,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @return Indexes of keys for which values were generated on primary node.
      */
     @Override @Nullable public List<Integer> nearValuesIndexes() {
-        if (hasNearVal && key != null)
+        if (hasNearVal)
             return Collections.singletonList(0);
 
         return null;


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

Posted by vo...@apache.org.
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(


[50/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
Review.


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

Branch: refs/heads/ignite-2523
Commit: 0a04244945c2f9fef22bf7ae25d7605921a2e605
Parents: 1829f44
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:20:59 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:20:59 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          |  58 ++--
 .../GridDhtAtomicMultipleUpdateRequest.java     |   2 +-
 .../GridDhtAtomicMultipleUpdateResponse.java    |   2 +-
 .../GridDhtAtomicSingleUpdateRequest.java       |   2 +-
 .../GridDhtAtomicSingleUpdateResponse.java      |   2 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  28 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 271 +++++++++++++++++++
 .../GridDhtAtomicUpdateRequestInterface.java    | 271 -------------------
 .../dht/atomic/GridDhtAtomicUpdateResponse.java | 111 ++++++++
 .../GridDhtAtomicUpdateResponseInterface.java   | 112 --------
 .../GridNearAtomicMultipleUpdateRequest.java    |   8 +-
 .../GridNearAtomicMultipleUpdateResponse.java   |   2 +-
 .../GridNearAtomicSingleUpdateRequest.java      |   8 +-
 .../GridNearAtomicSingleUpdateResponse.java     |   2 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  38 +--
 .../dht/atomic/GridNearAtomicUpdateRequest.java | 207 ++++++++++++++
 .../GridNearAtomicUpdateRequestInterface.java   | 207 --------------
 .../atomic/GridNearAtomicUpdateResponse.java    | 211 +++++++++++++++
 .../GridNearAtomicUpdateResponseInterface.java  | 211 ---------------
 .../distributed/near/GridNearAtomicCache.java   |  16 +-
 .../IgniteClientReconnectCollectionsTest.java   |   4 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   4 +-
 22 files changed, 888 insertions(+), 889 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 6965a9c..d1423f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -141,7 +141,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Integer.getInteger(IGNITE_ATOMIC_DEFERRED_ACK_TIMEOUT, 500);
 
     /** Update reply closure. */
-    private CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> updateReplyClos;
+    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
 
     /** Pending  */
     private ConcurrentMap<UUID, DeferredResponseBuffer> pendingResponses = new ConcurrentHashMap8<>();
@@ -194,9 +194,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        updateReplyClos = new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface>() {
+        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-            @Override public void apply(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponseInterface res) {
+            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
                 if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
                     assert req.writeSynchronizationMode() != FULL_ASYNC : req;
 
@@ -1331,8 +1331,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal(
         final UUID nodeId,
-        final GridNearAtomicUpdateRequestInterface req,
-        final CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb
+        final GridNearAtomicUpdateRequest req,
+        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
@@ -1356,10 +1356,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal0(
         UUID nodeId,
-        GridNearAtomicUpdateRequestInterface req,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb
+        GridNearAtomicUpdateRequest req,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
-        GridNearAtomicUpdateResponseInterface res;
+        GridNearAtomicUpdateResponse res;
 
         if (req instanceof GridNearAtomicSingleUpdateRequest)
             res = new GridNearAtomicSingleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
@@ -1588,12 +1588,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateBatchResult updateWithBatch(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequestInterface req,
-        GridNearAtomicUpdateResponseInterface res,
+        GridNearAtomicUpdateRequest req,
+        GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2004,12 +2004,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateSingleResult updateSingle(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequestInterface req,
-        GridNearAtomicUpdateResponseInterface res,
+        GridNearAtomicUpdateRequest req,
+        GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2266,9 +2266,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable Collection<KeyCacheObject> rmvKeys,
         @Nullable Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
-        final GridNearAtomicUpdateRequestInterface req,
-        final GridNearAtomicUpdateResponseInterface res,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        final GridNearAtomicUpdateRequest req,
+        final GridNearAtomicUpdateResponse res,
         boolean replicate,
         UpdateBatchResult batchRes,
         String taskName,
@@ -2658,8 +2658,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      *      will return false.
      * @return {@code True} if filter evaluation succeeded.
      */
-    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequestInterface req,
-        GridNearAtomicUpdateResponseInterface res) {
+    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
+        GridNearAtomicUpdateResponse res) {
         try {
             return ctx.isAllLocked(entry, req.filter());
         }
@@ -2673,7 +2673,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /**
      * @param req Request to remap.
      */
-    private void remapToNewPrimary(GridNearAtomicUpdateRequestInterface req) {
+    private void remapToNewPrimary(GridNearAtomicUpdateRequest req) {
         assert req.writeSynchronizationMode() == FULL_ASYNC : req;
 
         if (log.isDebugEnabled())
@@ -2752,9 +2752,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequestInterface updateReq,
-        GridNearAtomicUpdateResponseInterface updateRes,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
+        GridNearAtomicUpdateRequest updateReq,
+        GridNearAtomicUpdateResponse updateRes,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean force
     ) {
         if (!force) {
@@ -2785,7 +2785,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Sender node ID.
      * @param req Near atomic update request.
      */
-    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
+    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequest req) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
 
@@ -2799,7 +2799,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param res Near atomic update response.
      */
     @SuppressWarnings("unchecked")
-    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponseInterface res) {
+    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponse res) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
 
@@ -2818,14 +2818,14 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Sender node ID.
      * @param req Dht atomic update request.
      */
-    private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequestInterface req) {
+    private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequest req) {
         if (log.isDebugEnabled())
             log.debug("Processing dht atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
 
         GridCacheVersion ver = req.writeVersion();
 
         // Always send update reply.
-        GridDhtAtomicUpdateResponseInterface res;
+        GridDhtAtomicUpdateResponse res;
 
         if (req instanceof GridDhtAtomicSingleUpdateRequest)
             res = new GridDhtAtomicSingleUpdateResponse(ctx.cacheId(), req.futureVersion(),
@@ -2999,7 +2999,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param res Dht atomic update response.
      */
     @SuppressWarnings("unchecked")
-    private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponseInterface res) {
+    private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponse res) {
         if (log.isDebugEnabled())
             log.debug("Processing dht atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
 
@@ -3036,7 +3036,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Originating node ID.
      * @param res Near update response.
      */
-    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponseInterface res) {
+    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) {
         try {
             ctx.io().send(nodeId, (GridCacheMessage)res, ctx.ioPolicy());
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
index de89b47..becec6e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
@@ -49,7 +49,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Lite dht cache backup update request.
  */
-public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
+public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
index 4853ef5..6f11686 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
@@ -41,7 +41,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 /**
  * DHT atomic cache backup update response.
  */
-public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
+public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index a2ed9b1..2b29df6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -43,7 +43,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.UUID;
 
-public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
+public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index 488bf7f..fc5a8b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -35,7 +35,7 @@ import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.Collections;
 
-public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
+public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 6e2ed31..df50542 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -79,20 +79,20 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
 
     /** Completion callback. */
     @GridToStringExclude
-    private final CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb;
+    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
 
     /** Mappings. */
     @GridToStringInclude
-    private final Map<UUID, GridDhtAtomicUpdateRequestInterface> mappings;
+    private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
 
     /** Entries with readers. */
     private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
 
     /** Update request. */
-    private final GridNearAtomicUpdateRequestInterface updateReq;
+    private final GridNearAtomicUpdateRequest updateReq;
 
     /** Update response. */
-    private final GridNearAtomicUpdateResponseInterface updateRes;
+    private final GridNearAtomicUpdateResponse updateRes;
 
     /** Future keys. */
     private final Collection<KeyCacheObject> keys;
@@ -115,10 +115,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public GridDhtAtomicUpdateFuture(
         GridCacheContext cctx,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequestInterface updateReq,
-        GridNearAtomicUpdateResponseInterface updateRes
+        GridNearAtomicUpdateRequest updateReq,
+        GridNearAtomicUpdateResponse updateRes
     ) {
         this.cctx = cctx;
         this.writeVer = writeVer;
@@ -171,7 +171,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
     private boolean registerResponse(UUID nodeId) {
         int resCnt0;
 
-        GridDhtAtomicUpdateRequestInterface req = mappings.get(nodeId);
+        GridDhtAtomicUpdateRequest req = mappings.get(nodeId);
 
         if (req != null) {
             synchronized (this) {
@@ -248,7 +248,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
             UUID nodeId = node.id();
 
             if (!nodeId.equals(cctx.localNodeId())) {
-                GridDhtAtomicUpdateRequestInterface updateReq = mappings.get(nodeId);
+                GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
 
                 if (updateReq == null) {
                     if (this.updateReq instanceof GridNearAtomicSingleUpdateRequest)
@@ -338,7 +338,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
         AffinityTopologyVersion topVer = updateReq.topologyVersion();
 
         for (UUID nodeId : readers) {
-            GridDhtAtomicUpdateRequestInterface updateReq = mappings.get(nodeId);
+            GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
 
             if (updateReq == null) {
                 ClusterNode node = cctx.discovery().node(nodeId);
@@ -402,7 +402,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                     Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
 
                     exit:
-                    for (GridDhtAtomicUpdateRequestInterface req : mappings.values()) {
+                    for (GridDhtAtomicUpdateRequest req : mappings.values()) {
                         for (int i = 0; i < req.size(); i++) {
                             KeyCacheObject key = req.key(i);
 
@@ -432,7 +432,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                 if (lsnrs != null) {
                     Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
 
-                    exit: for (GridDhtAtomicUpdateRequestInterface req : mappings.values()) {
+                    exit: for (GridDhtAtomicUpdateRequest req : mappings.values()) {
                         for (int i = 0; i < req.size(); i++) {
                             KeyCacheObject key = req.key(i);
 
@@ -480,7 +480,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public void map() {
         if (!mappings.isEmpty()) {
-            for (GridDhtAtomicUpdateRequestInterface req : mappings.values()) {
+            for (GridDhtAtomicUpdateRequest req : mappings.values()) {
                 try {
                     if (log.isDebugEnabled())
                         log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
@@ -516,7 +516,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      * @param nodeId Backup node ID.
      * @param updateRes Update response.
      */
-    public void onResult(UUID nodeId, GridDhtAtomicUpdateResponseInterface updateRes) {
+    public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
         if (log.isDebugEnabled())
             log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
new file mode 100644
index 0000000..3e97462
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+import javax.cache.processor.EntryProcessor;
+import java.util.Collection;
+import java.util.UUID;
+
+/**
+ * Base interface for DHT atomic update requests.
+ */
+public interface GridDhtAtomicUpdateRequest extends Message {
+
+    /**
+     * @return Force transform backups flag.
+     */
+    boolean forceTransformBackups();
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
+     * @param addPrevVal If {@code true} adds previous value.
+     * @param prevVal Previous value.
+     */
+    void addWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean addPrevVal,
+        int partId,
+        @Nullable CacheObject prevVal,
+        @Nullable Long updateIdx,
+        boolean storeLocPrevVal);
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL.
+     * @param expireTime Expire time.
+     */
+    void addNearWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long expireTime);
+
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
+    int lookupIndex();
+
+    /**
+     * @return Node ID.
+     */
+    UUID nodeId();
+
+    /**
+     * @return Subject ID.
+     */
+    UUID subjectId();
+
+    /**
+     * @return Task name.
+     */
+    int taskNameHash();
+
+    /**
+     * @return Keys size.
+     */
+    int size();
+
+    /**
+     * @return Keys size.
+     */
+    int nearSize();
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    GridCacheVersion futureVersion();
+
+    /**
+     * @return Write version.
+     */
+    GridCacheVersion writeVersion();
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    CacheWriteSynchronizationMode writeSynchronizationMode();
+
+    /**
+     * @return Topology version.
+     */
+    AffinityTopologyVersion topologyVersion();
+
+    /**
+     * @return Keys.
+     */
+    Collection<KeyCacheObject> keys();
+
+    /**
+     * @param idx Key index.
+     * @return Key.
+     */
+    KeyCacheObject key(int idx);
+
+    /**
+     * @param idx Partition index.
+     * @return Partition id.
+     */
+    int partitionId(int idx);
+
+    /**
+     * @param updCntr Update counter.
+     * @return Update counter.
+     */
+    Long updateCounter(int updCntr);
+
+    /**
+     * @param idx Near key index.
+     * @return Key.
+     */
+    KeyCacheObject nearKey(int idx);
+
+    /**
+     * @return Keep binary flag.
+     */
+    boolean keepBinary();
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Nullable CacheObject value(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Nullable CacheObject previousValue(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Nullable CacheObject localPreviousValue(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    @Nullable EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+    /**
+     * @param idx Near key index.
+     * @return Value.
+     */
+    @Nullable CacheObject nearValue(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Transform closure.
+     */
+    @Nullable EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Nullable GridCacheVersion conflictVersion(int idx);
+
+    /**
+     * @param idx Index.
+     * @return TTL.
+     */
+    long ttl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    long nearTtl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    long conflictExpireTime(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    long nearExpireTime(int idx);
+
+    /**
+     * @return {@code True} if on response flag changed.
+     */
+    boolean onResponse();
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable Object[] invokeArguments();
+
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
+
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
+
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
+    boolean addDeploymentInfo();
+
+    /**
+     * @return Error.
+     */
+    IgniteCheckedException classError();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java
deleted file mode 100644
index 43e6698..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-import javax.cache.processor.EntryProcessor;
-import java.util.Collection;
-import java.util.UUID;
-
-/**
- * Base interface for DHT atomic update requests.
- */
-public interface GridDhtAtomicUpdateRequestInterface extends Message {
-
-    /**
-     * @return Force transform backups flag.
-     */
-    boolean forceTransformBackups();
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL (optional).
-     * @param conflictExpireTime Conflict expire time (optional).
-     * @param conflictVer Conflict version (optional).
-     * @param addPrevVal If {@code true} adds previous value.
-     * @param prevVal Previous value.
-     */
-    void addWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean addPrevVal,
-        int partId,
-        @Nullable CacheObject prevVal,
-        @Nullable Long updateIdx,
-        boolean storeLocPrevVal);
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL.
-     * @param expireTime Expire time.
-     */
-    void addNearWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long expireTime);
-
-    /**
-     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
-     *
-     * @return Message lookup index.
-     */
-    int lookupIndex();
-
-    /**
-     * @return Node ID.
-     */
-    UUID nodeId();
-
-    /**
-     * @return Subject ID.
-     */
-    UUID subjectId();
-
-    /**
-     * @return Task name.
-     */
-    int taskNameHash();
-
-    /**
-     * @return Keys size.
-     */
-    int size();
-
-    /**
-     * @return Keys size.
-     */
-    int nearSize();
-
-    /**
-     * @return Version assigned on primary node.
-     */
-    GridCacheVersion futureVersion();
-
-    /**
-     * @return Write version.
-     */
-    GridCacheVersion writeVersion();
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    CacheWriteSynchronizationMode writeSynchronizationMode();
-
-    /**
-     * @return Topology version.
-     */
-    AffinityTopologyVersion topologyVersion();
-
-    /**
-     * @return Keys.
-     */
-    Collection<KeyCacheObject> keys();
-
-    /**
-     * @param idx Key index.
-     * @return Key.
-     */
-    KeyCacheObject key(int idx);
-
-    /**
-     * @param idx Partition index.
-     * @return Partition id.
-     */
-    int partitionId(int idx);
-
-    /**
-     * @param updCntr Update counter.
-     * @return Update counter.
-     */
-    Long updateCounter(int updCntr);
-
-    /**
-     * @param idx Near key index.
-     * @return Key.
-     */
-    KeyCacheObject nearKey(int idx);
-
-    /**
-     * @return Keep binary flag.
-     */
-    boolean keepBinary();
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable CacheObject value(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable CacheObject previousValue(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable CacheObject localPreviousValue(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    @Nullable EntryProcessor<Object, Object, Object> entryProcessor(int idx);
-
-    /**
-     * @param idx Near key index.
-     * @return Value.
-     */
-    @Nullable CacheObject nearValue(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Transform closure.
-     */
-    @Nullable EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable GridCacheVersion conflictVersion(int idx);
-
-    /**
-     * @param idx Index.
-     * @return TTL.
-     */
-    long ttl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    long nearTtl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    long conflictExpireTime(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    long nearExpireTime(int idx);
-
-    /**
-     * @return {@code True} if on response flag changed.
-     */
-    boolean onResponse();
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable Object[] invokeArguments();
-
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
-
-    /**
-     * This method is called after the message is deserialized and is responsible for
-     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
-
-    /**
-     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
-     *
-     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
-     */
-    boolean addDeploymentInfo();
-
-    /**
-     * @return Error.
-     */
-    IgniteCheckedException classError();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
new file mode 100644
index 0000000..98ac76b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import java.util.Collection;
+
+/**
+ * Base interface for DHT atomic update responses.
+ */
+public interface GridDhtAtomicUpdateResponse extends Message {
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
+    int lookupIndex();
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    GridCacheVersion futureVersion();
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    void onError(IgniteCheckedException err);
+
+    /**
+     * @return Error, if any.
+     */
+    IgniteCheckedException error();
+
+    /**
+     * @return Failed keys.
+     */
+    Collection<KeyCacheObject> failedKeys();
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    void addFailedKey(KeyCacheObject key, Throwable e);
+
+    /**
+     * @return Evicted readers.
+     */
+    Collection<KeyCacheObject> nearEvicted();
+
+    /**
+     * Adds near evicted key..
+     *
+     * @param key Evicted key.
+     */
+    void addNearEvicted(KeyCacheObject key);
+
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
+
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
+
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
+    boolean addDeploymentInfo();
+
+    /**
+     * @return Message ID.
+     */
+    long messageId();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java
deleted file mode 100644
index 7defbf0..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import java.util.Collection;
-
-/**
- * Base interface for DHT atomic update responses.
- */
-public interface GridDhtAtomicUpdateResponseInterface extends Message {
-
-    /**
-     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
-     *
-     * @return Message lookup index.
-     */
-    int lookupIndex();
-
-    /**
-     * @return Version assigned on primary node.
-     */
-    GridCacheVersion futureVersion();
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    void onError(IgniteCheckedException err);
-
-    /**
-     * @return Error, if any.
-     */
-    IgniteCheckedException error();
-
-    /**
-     * @return Failed keys.
-     */
-    Collection<KeyCacheObject> failedKeys();
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    void addFailedKey(KeyCacheObject key, Throwable e);
-
-    /**
-     * @return Evicted readers.
-     */
-    Collection<KeyCacheObject> nearEvicted();
-
-    /**
-     * Adds near evicted key..
-     *
-     * @param key Evicted key.
-     */
-    void addNearEvicted(KeyCacheObject key);
-
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
-
-    /**
-     * This method is called after the message is deserialized and is responsible for
-     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
-
-    /**
-     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
-     *
-     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
-     */
-    boolean addDeploymentInfo();
-
-    /**
-     * @return Message ID.
-     */
-    long messageId();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index d1c3654..d702202 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -59,7 +59,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -158,7 +158,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicUpdateResponseInterface res;
+    private GridNearAtomicUpdateResponse res;
 
     /** Maximum possible size of inner collections. */
     @GridDirectTransient
@@ -503,7 +503,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -514,7 +514,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
index 15e6b1b..7cb8886 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -47,7 +47,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * DHT atomic cache near update response.
  */
-public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
+public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/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 ce086d2..61889e3 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
@@ -58,7 +58,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -150,7 +150,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicUpdateResponseInterface res;
+    private GridNearAtomicUpdateResponse res;
 
     /**
      * Empty constructor required by {@link Externalizable}.
@@ -428,7 +428,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -439,7 +439,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index 075f477..c7e5c8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -41,7 +41,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
-public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
+public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
 
     /** */
     private static final long serialVersionUID = 0L;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/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 de89d91..82a2a8c 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
@@ -339,7 +339,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param res Update response.
      */
-    public void onResult(UUID nodeId, GridNearAtomicUpdateResponseInterface res) {
+    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
         state.onResult(nodeId, res, false);
     }
 
@@ -349,7 +349,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param req Update request.
      * @param res Update response.
      */
-    private void updateNear(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponseInterface res) {
+    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
         assert nearEnabled;
 
         if (res.remapKeys() != null || !req.hasPrimary())
@@ -451,12 +451,12 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param req Request.
      */
-    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
+    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface>() {
-                    @Override public void apply(GridNearAtomicUpdateRequestInterface req,
-                        GridNearAtomicUpdateResponseInterface res) {
+                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicUpdateRequest req,
+                        GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -510,9 +510,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
-                new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface>() {
-                    @Override public void apply(GridNearAtomicUpdateRequestInterface req,
-                        GridNearAtomicUpdateResponseInterface res) {
+                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicUpdateRequest req,
+                        GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -555,7 +555,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         private Collection<KeyCacheObject> remapKeys;
 
         /** Not null is operation is mapped to single node. */
-        private GridNearAtomicUpdateRequestInterface singleReq;
+        private GridNearAtomicUpdateRequest singleReq;
 
         /** Operation result. */
         private GridCacheReturn opRes;
@@ -571,10 +571,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeId Left node ID.
          */
         void onNodeLeft(UUID nodeId) {
-            GridNearAtomicUpdateResponseInterface res = null;
+            GridNearAtomicUpdateResponse res = null;
 
             synchronized (this) {
-                GridNearAtomicUpdateRequestInterface req;
+                GridNearAtomicUpdateRequest req;
 
                 if (singleReq != null)
                     req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
@@ -612,8 +612,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeErr {@code True} if response was created on node failure.
          */
         @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"}) void onResult(UUID nodeId,
-            GridNearAtomicUpdateResponseInterface res, boolean nodeErr) {
-            GridNearAtomicUpdateRequestInterface req;
+            GridNearAtomicUpdateResponse res, boolean nodeErr) {
+            GridNearAtomicUpdateRequest req;
 
             AffinityTopologyVersion remapTopVer = null;
 
@@ -744,7 +744,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
                     for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
-                        GridNearAtomicUpdateResponseInterface res0 = req0.response();
+                        GridNearAtomicUpdateResponse res0 = req0.response();
 
                         assert res0 != null : req0;
 
@@ -817,9 +817,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param req Request.
          * @param e Error.
          */
-        void onSendError(GridNearAtomicUpdateRequestInterface req, IgniteCheckedException e) {
+        void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
             synchronized (this) {
-                GridNearAtomicUpdateResponseInterface res;
+                GridNearAtomicUpdateResponse res;
 
                 if (req instanceof GridNearAtomicSingleUpdateRequest)
                     res = new GridNearAtomicSingleUpdateResponse(cctx.cacheId(),
@@ -853,7 +853,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             }
 
             Exception err = null;
-            GridNearAtomicUpdateRequestInterface singleReq0 = null;
+            GridNearAtomicUpdateRequest singleReq0 = null;
             Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings0 = null;
 
             int size = keys.size();
@@ -1138,7 +1138,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @return Request.
          * @throws Exception If failed.
          */
-        private GridNearAtomicUpdateRequestInterface mapSingleUpdate(AffinityTopologyVersion topVer,
+        private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
             Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer)
             throws Exception {
             Object key = F.first(keys);

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
new file mode 100644
index 0000000..b2d847b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Base interface for near atomic update requests.
+ */
+public interface GridNearAtomicUpdateRequest extends Message {
+    /**
+     * @return Message ID.
+     */
+    public long messageId();
+
+    /**
+     * @return Mapped node ID.
+     */
+    public UUID nodeId();
+
+    /**
+     * @param nodeId Node ID.
+     */
+    public void nodeId(UUID nodeId);
+
+    /**
+     * @return Subject ID.
+     */
+    public UUID subjectId();
+
+    /**
+     * @return Task name hash.
+     */
+    public int taskNameHash();
+
+    /**
+     * @return Future version.
+     */
+    public GridCacheVersion futureVersion();
+
+    /**
+     * @return Flag indicating whether this is fast-map udpate.
+     */
+    public boolean fastMap();
+
+    /**
+     * @return Update version for fast-map request.
+     */
+    public GridCacheVersion updateVersion();
+
+    /**
+     * @return Topology version.
+     */
+    public AffinityTopologyVersion topologyVersion();
+
+    /**
+     * @return Topology locked flag.
+     */
+    public boolean topologyLocked();
+
+    /**
+     * @return {@code True} if request sent from client node.
+     */
+    public boolean clientRequest();
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    public CacheWriteSynchronizationMode writeSynchronizationMode();
+
+    /**
+     * @return Expiry policy.
+     */
+    public ExpiryPolicy expiry();
+
+    /**
+     * @return Return value flag.
+     */
+    public boolean returnValue();
+
+    /**
+     * @return Filter.
+     */
+    @Nullable public CacheEntryPredicate[] filter();
+
+    /**
+     * @return Skip write-through to a persistent storage.
+     */
+    public boolean skipStore();
+
+    /**
+     * @return Keep binary flag.
+     */
+    public boolean keepBinary();
+
+    /**
+     * @return Keys for this update request.
+     */
+    public List<KeyCacheObject> keys();
+
+    /**
+     * @return Values for this update request.
+     */
+    public List<?> values();
+
+    /**
+     * @return Update operation.
+     */
+    public GridCacheOperation operation();
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable public Object[] invokeArguments();
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    public CacheObject value(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+    /**
+     * @param idx Index to get.
+     * @return Write value - either value, or transform closure.
+     */
+    public CacheObject writeValue(int idx);
+
+    /**
+     * @return Conflict versions.
+     */
+    @Nullable public List<GridCacheVersion> conflictVersions();
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Nullable public GridCacheVersion conflictVersion(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict TTL.
+     */
+    public long conflictTtl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    public long conflictExpireTime(int idx);
+
+    /**
+     * @return Flag indicating whether this request contains primary keys.
+     */
+    public boolean hasPrimary();
+
+    /**
+     * @param res Response.
+     * @return {@code True} if current response was {@code null}.
+     */
+    public boolean onResponse(GridNearAtomicUpdateResponse res);
+
+    /**
+     * @return Response.
+     */
+    @Nullable public GridNearAtomicUpdateResponse response();
+
+    /**
+     * Cleanup values.
+     *
+     * @param clearKeys If {@code true} clears keys.
+     */
+    void cleanup(boolean clearKeys);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
deleted file mode 100644
index f0f511b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Base interface for near atomic update requests.
- */
-public interface GridNearAtomicUpdateRequestInterface extends Message {
-    /**
-     * @return Message ID.
-     */
-    public long messageId();
-
-    /**
-     * @return Mapped node ID.
-     */
-    public UUID nodeId();
-
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId);
-
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId();
-
-    /**
-     * @return Task name hash.
-     */
-    public int taskNameHash();
-
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion();
-
-    /**
-     * @return Flag indicating whether this is fast-map udpate.
-     */
-    public boolean fastMap();
-
-    /**
-     * @return Update version for fast-map request.
-     */
-    public GridCacheVersion updateVersion();
-
-    /**
-     * @return Topology version.
-     */
-    public AffinityTopologyVersion topologyVersion();
-
-    /**
-     * @return Topology locked flag.
-     */
-    public boolean topologyLocked();
-
-    /**
-     * @return {@code True} if request sent from client node.
-     */
-    public boolean clientRequest();
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode();
-
-    /**
-     * @return Expiry policy.
-     */
-    public ExpiryPolicy expiry();
-
-    /**
-     * @return Return value flag.
-     */
-    public boolean returnValue();
-
-    /**
-     * @return Filter.
-     */
-    @Nullable public CacheEntryPredicate[] filter();
-
-    /**
-     * @return Skip write-through to a persistent storage.
-     */
-    public boolean skipStore();
-
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary();
-
-    /**
-     * @return Keys for this update request.
-     */
-    public List<KeyCacheObject> keys();
-
-    /**
-     * @return Values for this update request.
-     */
-    public List<?> values();
-
-    /**
-     * @return Update operation.
-     */
-    public GridCacheOperation operation();
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments();
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    public CacheObject value(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
-
-    /**
-     * @param idx Index to get.
-     * @return Write value - either value, or transform closure.
-     */
-    public CacheObject writeValue(int idx);
-
-    /**
-     * @return Conflict versions.
-     */
-    @Nullable public List<GridCacheVersion> conflictVersions();
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict TTL.
-     */
-    public long conflictTtl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx);
-
-    /**
-     * @return Flag indicating whether this request contains primary keys.
-     */
-    public boolean hasPrimary();
-
-    /**
-     * @param res Response.
-     * @return {@code True} if current response was {@code null}.
-     */
-    public boolean onResponse(GridNearAtomicUpdateResponseInterface res);
-
-    /**
-     * @return Response.
-     */
-    @Nullable public GridNearAtomicUpdateResponseInterface response();
-
-    /**
-     * Cleanup values.
-     *
-     * @param clearKeys If {@code true} clears keys.
-     */
-    void cleanup(boolean clearKeys);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
new file mode 100644
index 0000000..4c4e8c1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Base interface for near atomic update responses.
+ */
+public interface GridNearAtomicUpdateResponse extends Message {
+
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
+    int lookupIndex();
+
+    /**
+     * @return Mapped node ID.
+     */
+    UUID nodeId();
+
+    /**
+     * @param nodeId Node ID.
+     */
+    void nodeId(UUID nodeId);
+
+    /**
+     * @return Future version.
+     */
+    GridCacheVersion futureVersion();
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    void error(IgniteCheckedException err);
+
+    /**
+     * @return Error, if any.
+     */
+    IgniteCheckedException error();
+
+    /**
+     * @return Collection of failed keys.
+     */
+    Collection<KeyCacheObject> failedKeys();
+
+    /**
+     * @return Return value.
+     */
+    GridCacheReturn returnValue();
+
+    /**
+     * @param ret Return value.
+     */
+    @SuppressWarnings("unchecked") void returnValue(GridCacheReturn ret);
+
+    /**
+     * @param remapKeys Remap keys.
+     */
+    void remapKeys(List<KeyCacheObject> remapKeys);
+
+    /**
+     * @return Remap keys.
+     */
+    Collection<KeyCacheObject> remapKeys();
+
+    /**
+     * Adds value to be put in near cache on originating node.
+     *
+     * @param keyIdx Key index.
+     * @param val Value.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime);
+
+    /**
+     * @param keyIdx Key index.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach") void addNearTtl(int keyIdx, long ttl, long expireTime);
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    long nearExpireTime(int idx);
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    long nearTtl(int idx);
+
+    /**
+     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+     */
+    void nearVersion(GridCacheVersion nearVer);
+
+    /**
+     * @return Version generated on primary node to be used for originating node's near cache update.
+     */
+    GridCacheVersion nearVersion();
+
+    /**
+     * @param keyIdx Index of key for which update was skipped
+     */
+    void addSkippedIndex(int keyIdx);
+
+    /**
+     * @return Indexes of keys for which update was skipped
+     */
+    @Nullable List<Integer> skippedIndexes();
+
+    /**
+     * @return Indexes of keys for which values were generated on primary node.
+     */
+    @Nullable List<Integer> nearValuesIndexes();
+
+    /**
+     * @param idx Index.
+     * @return Value generated on primary node which should be put to originating node's near cache.
+     */
+    @Nullable CacheObject nearValue(int idx);
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    void addFailedKey(KeyCacheObject key, Throwable e);
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     */
+    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e);
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     * @param ctx Context.
+     */
+    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx);
+
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
+
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
+
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
+    boolean addDeploymentInfo();
+}


[19/51] [abbrv] ignite git commit: ignite-2523 : Created SingleUpdateResponse

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 63c073d..2546691 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -45,8 +45,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvali
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -128,7 +128,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      */
     public void processNearAtomicUpdateResponse(
         GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res
+        GridNearAtomicMultipleUpdateResponse res
     ) {
         if (F.size(res.failedKeys()) == req.keys().size())
             return;

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index ad6c46f..37937d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -49,7 +49,7 @@ import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse;
@@ -806,7 +806,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
                     if (syncMode != FULL_ASYNC) {
                         Class<?> cls = (ccfg.getAtomicityMode() == ATOMIC) ?
-                            GridNearAtomicUpdateResponse.class : GridNearTxPrepareResponse.class;
+                            GridNearAtomicMultipleUpdateResponse.class : GridNearTxPrepareResponse.class;
 
                         log.info("Test cache put [atomicity=" + atomicityMode +
                             ", writeOrder=" + writeOrder +

http://git-wip-us.apache.org/repos/asf/ignite/blob/dfdd2f4f/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index 100e8de..d25ac37 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.IgniteClientDisconnectedException;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.testframework.GridTestUtils;
 
@@ -315,7 +315,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
+            commSpi.blockMessage(GridNearAtomicMultipleUpdateResponse.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 
@@ -457,7 +457,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
+            commSpi.blockMessage(GridNearAtomicMultipleUpdateResponse.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 


[47/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
deleted file mode 100644
index a8d0169..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * DHT atomic cache backup update response.
- */
-public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> failedKeys;
-
-    /** Update error. */
-    @GridDirectTransient
-    private IgniteCheckedException err;
-
-    /** Serialized update error. */
-    private byte[] errBytes;
-
-    /** Evicted readers. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearEvicted;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridDhtAtomicUpdateResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param cacheId Cache ID.
-     * @param futVer Future version.
-     * @param addDepInfo Deployment info.
-     */
-    public GridDhtAtomicUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
-        this.cacheId = cacheId;
-        this.futVer = futVer;
-        this.addDepInfo = addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onError(IgniteCheckedException err) {
-        this.err = err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteCheckedException error() {
-        return err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>();
-
-        failedKeys.add(key);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<KeyCacheObject> nearEvicted() {
-        return nearEvicted;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addNearEvicted(KeyCacheObject key) {
-        if (nearEvicted == null)
-            nearEvicted = new ArrayList<>();
-
-        nearEvicted.add(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(failedKeys, cctx);
-
-        prepareMarshalCacheObjects(nearEvicted, cctx);
-
-        if (errBytes == null)
-            errBytes = ctx.marshaller().marshal(err);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
-
-        if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeByteArray("errBytes", errBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                errBytes = reader.readByteArray("errBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridDhtAtomicUpdateResponse.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 39;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 7;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtAtomicUpdateResponse.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
new file mode 100644
index 0000000..d1c3654
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -0,0 +1,989 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+
+/**
+ * Lite DHT cache update request sent from near node to primary node.
+ */
+public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
+    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Target node ID. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Fast map flag. */
+    private boolean fastMap;
+
+    /** Update version. Set to non-null if fastMap is {@code true}. */
+    private GridCacheVersion updateVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+    private boolean topLocked;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Update operation. */
+    private GridCacheOperation op;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** Conflict TTLs. */
+    private GridLongList conflictTtls;
+
+    /** Conflict expire times. */
+    private GridLongList conflictExpireTimes;
+
+    /** Return value flag. */
+    private boolean retval;
+
+    /** Expiry policy. */
+    @GridDirectTransient
+    private ExpiryPolicy expiryPlc;
+
+    /** Expiry policy bytes. */
+    private byte[] expiryPlcBytes;
+
+    /** Filter. */
+    private CacheEntryPredicate[] filter;
+
+    /** Flag indicating whether request contains primary keys. */
+    private boolean hasPrimary;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Skip write-through to a persistent storage. */
+    private boolean skipStore;
+
+    /** */
+    private boolean clientReq;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /** */
+    @GridDirectTransient
+    private GridNearAtomicUpdateResponseInterface res;
+
+    /** Maximum possible size of inner collections. */
+    @GridDirectTransient
+    private int initSize;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicMultipleUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param fastMap Fast map scheme flag.
+     * @param updateVer Update version set if fast map is performed.
+     * @param topVer Topology version.
+     * @param topLocked Topology locked flag.
+     * @param syncMode Synchronization mode.
+     * @param op Cache update operation.
+     * @param retval Return value required flag.
+     * @param expiryPlc Expiry policy.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param filter Optional filter for atomic check.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param skipStore Skip write-through to a persistent storage.
+     * @param keepBinary Keep binary flag.
+     * @param clientReq Client node request flag.
+     * @param addDepInfo Deployment info flag.
+     * @param maxEntryCnt Maximum entries count.
+     */
+    public GridNearAtomicMultipleUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        boolean fastMap,
+        @Nullable GridCacheVersion updateVer,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean topLocked,
+        CacheWriteSynchronizationMode syncMode,
+        GridCacheOperation op,
+        boolean retval,
+        @Nullable ExpiryPolicy expiryPlc,
+        @Nullable Object[] invokeArgs,
+        @Nullable CacheEntryPredicate[] filter,
+        @Nullable UUID subjId,
+        int taskNameHash,
+        boolean skipStore,
+        boolean keepBinary,
+        boolean clientReq,
+        boolean addDepInfo,
+        int maxEntryCnt
+    ) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.fastMap = fastMap;
+        this.updateVer = updateVer;
+
+        this.topVer = topVer;
+        this.topLocked = topLocked;
+        this.syncMode = syncMode;
+        this.op = op;
+        this.retval = retval;
+        this.expiryPlc = expiryPlc;
+        this.invokeArgs = invokeArgs;
+        this.filter = filter;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.skipStore = skipStore;
+        this.keepBinary = keepBinary;
+        this.clientReq = clientReq;
+        this.addDepInfo = addDepInfo;
+
+        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
+        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
+        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
+        // than 10, we use it.
+        initSize = Math.min(maxEntryCnt, 10);
+
+        keys = new ArrayList<>(initSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean fastMap() {
+        return fastMap;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion updateVersion() {
+        return updateVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean topologyLocked() {
+        return topLocked;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean clientRequest() {
+        return clientReq;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ExpiryPolicy expiry() {
+        return expiryPlc;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean returnValue() {
+        return retval;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public CacheEntryPredicate[] filter() {
+        return filter;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean skipStore() {
+        return skipStore;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /**
+     * @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).
+     * @param primary If given key is primary on this mapping.
+     */
+    @SuppressWarnings("unchecked")
+    public void addUpdateEntry(KeyCacheObject key,
+        @Nullable Object val,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean primary) {
+        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;
+
+        keys.add(key);
+
+        if (entryProcessor != null) {
+            if (entryProcessors == null)
+                entryProcessors = new ArrayList<>(initSize);
+
+            entryProcessors.add(entryProcessor);
+        }
+        else if (val != null) {
+            assert val instanceof CacheObject : val;
+
+            if (vals == null)
+                vals = new ArrayList<>(initSize);
+
+            vals.add((CacheObject)val);
+        }
+
+        hasPrimary |= primary;
+
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>(initSize);
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictVers.add(null);
+            }
+
+            conflictVers.add(conflictVer);
+        }
+        else if (conflictVers != null)
+            conflictVers.add(null);
+
+        if (conflictTtl >= 0) {
+            if (conflictTtls == null) {
+                conflictTtls = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictTtls.add(CU.TTL_NOT_CHANGED);
+            }
+
+            conflictTtls.add(conflictTtl);
+        }
+
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+
+            conflictExpireTimes.add(conflictExpireTime);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<KeyCacheObject> keys() {
+        return keys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<?> values() {
+        return op == TRANSFORM ? entryProcessors : vals;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheOperation operation() {
+        return op;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public CacheObject value(int idx) {
+        assert op == UPDATE : op;
+
+        return vals.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        assert op == TRANSFORM : op;
+
+        return entryProcessors.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheObject writeValue(int idx) {
+        if (vals != null)
+            return vals.get(idx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
+        return conflictVers;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
+
+            return conflictVers.get(idx);
+        }
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictTtl(int idx) {
+        if (conflictTtls != null) {
+            assert idx >= 0 && idx < conflictTtls.size();
+
+            return conflictTtls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
+
+            return conflictExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean hasPrimary() {
+        return hasPrimary;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
+        if (this.res == null) {
+            this.res = res;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(keys, cctx);
+
+        if (filter != null) {
+            boolean hasFilter = false;
+
+            for (CacheEntryPredicate p : filter) {
+                if (p != null) {
+                    hasFilter = true;
+
+                    p.prepareMarshal(cctx);
+                }
+            }
+
+            if (!hasFilter)
+                filter = null;
+        }
+
+        if (expiryPlc != null && expiryPlcBytes == null)
+            expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+
+        if (op == TRANSFORM) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (entryProcessorsBytes == null)
+                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+        }
+        else
+            prepareMarshalCacheObjects(vals, cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+        if (op == TRANSFORM) {
+            if (entryProcessors == null)
+                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+        }
+        else
+            finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+        if (filter != null) {
+            for (CacheEntryPredicate p : filter) {
+                if (p != null)
+                    p.finishUnmarshal(cctx, ldr);
+            }
+        }
+
+        if (expiryPlcBytes != null && expiryPlc == null)
+            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeBoolean("clientReq", clientReq))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("conflictTtls", conflictTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("fastMap", fastMap))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeBoolean("hasPrimary", hasPrimary))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeBoolean("retval", retval))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeBoolean("skipStore", skipStore))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeBoolean("topLocked", topLocked))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("updateVer", updateVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 25:
+                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                clientReq = reader.readBoolean("clientReq");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                conflictTtls = reader.readMessage("conflictTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                fastMap = reader.readBoolean("fastMap");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                hasPrimary = reader.readBoolean("hasPrimary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                byte opOrd;
+
+                opOrd = reader.readByte("op");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                op = GridCacheOperation.fromOrdinal(opOrd);
+
+                reader.incrementState();
+
+            case 17:
+                retval = reader.readBoolean("retval");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                skipStore = reader.readBoolean("skipStore");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 19:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 21:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                topLocked = reader.readBoolean("topLocked");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                updateVer = reader.readMessage("updateVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 25:
+                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicMultipleUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cleanup(boolean clearKeys) {
+        vals = null;
+        entryProcessors = null;
+        entryProcessorsBytes = null;
+        invokeArgs = null;
+        invokeArgsBytes = null;
+
+        if (clearKeys)
+            keys = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 40;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 26;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicMultipleUpdateRequest.class, this, "filter", Arrays.toString(filter),
+            "parent", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
new file mode 100644
index 0000000..15e6b1b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -0,0 +1,575 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * DHT atomic cache near update response.
+ */
+public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID this reply should be sent to. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Update error. */
+    @GridDirectTransient
+    private volatile IgniteCheckedException err;
+
+    /** Serialized error. */
+    private byte[] errBytes;
+
+    /** Return value. */
+    @GridToStringInclude
+    private GridCacheReturn ret;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private volatile Collection<KeyCacheObject> failedKeys;
+
+    /** Keys that should be remapped. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> remapKeys;
+
+    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearValsIdxs;
+
+    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearSkipIdxs;
+
+    /** Values generated on primary node which should be put to originating node's near cache. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Version generated on primary node to be used for originating node's near cache update. */
+    private GridCacheVersion nearVer;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicMultipleUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID this reply should be sent to.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info flag.
+     */
+    public GridNearAtomicMultipleUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void error(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheReturn returnValue() {
+        return ret;
+    }
+
+    /** {@inheritDoc} */
+    @Override @SuppressWarnings("unchecked")
+    public void returnValue(GridCacheReturn ret) {
+        this.ret = ret;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
+        this.remapKeys = remapKeys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<KeyCacheObject> remapKeys() {
+        return remapKeys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime) {
+        if (nearValsIdxs == null) {
+            nearValsIdxs = new ArrayList<>();
+            nearVals = new ArrayList<>();
+        }
+
+        addNearTtl(keyIdx, ttl, expireTime);
+
+        nearValsIdxs.add(keyIdx);
+        nearVals.add(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override @SuppressWarnings("ForLoopReplaceableByForEach")
+    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearTtls.add(-1L);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearExpireTimes.add(-1);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void nearVersion(GridCacheVersion nearVer) {
+        this.nearVer = nearVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion nearVersion() {
+        return nearVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addSkippedIndex(int keyIdx) {
+        if (nearSkipIdxs == null)
+            nearSkipIdxs = new ArrayList<>();
+
+        nearSkipIdxs.add(keyIdx);
+
+        addNearTtl(keyIdx, -1L, -1L);
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public List<Integer> skippedIndexes() {
+        return nearSkipIdxs;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public List<Integer> nearValuesIndexes() {
+        return nearValsIdxs;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        return nearVals.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ConcurrentLinkedQueue<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
+        if (keys != null) {
+            if (failedKeys == null)
+                failedKeys = new ArrayList<>(keys.size());
+
+            failedKeys.addAll(keys);
+        }
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
+        GridCacheContext ctx) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>(keys.size());
+
+        failedKeys.addAll(keys);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        if (err != null && errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(remapKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        if (ret != null)
+            ret.prepareMarshal(cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        if (ret != null)
+            ret.finishUnmarshal(cctx, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("nearVer", nearVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeMessage("ret", ret))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearVer = reader.readMessage("nearVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                ret = reader.readMessage("ret");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicMultipleUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 41;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 14;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicMultipleUpdateResponse.class, this, "parent");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/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 7e6dc20..de89d91 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
@@ -482,13 +482,13 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      *
      * @param mappings Mappings to send.
      */
-    private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
+    private void doUpdate(Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings) {
         UUID locNodeId = cctx.localNodeId();
 
-        GridNearAtomicUpdateRequest locUpdate = null;
+        GridNearAtomicMultipleUpdateRequest locUpdate = null;
 
         // Send messages to remote nodes first, then run local update.
-        for (GridNearAtomicUpdateRequest req : mappings.values()) {
+        for (GridNearAtomicMultipleUpdateRequest req : mappings.values()) {
             if (locNodeId.equals(req.nodeId())) {
                 assert locUpdate == null : "Cannot have more than one local mapping [locUpdate=" + locUpdate +
                     ", req=" + req + ']';
@@ -537,7 +537,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         /** Mappings if operations is mapped to more than one node. */
         @GridToStringInclude
-        private Map<UUID, GridNearAtomicUpdateRequest> mappings;
+        private Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings;
 
         /** */
         private int resCnt;
@@ -588,7 +588,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                             req.futureVersion(),
                             cctx.deploymentEnabled());
                     else
-                        res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                        res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
                             nodeId,
                             req.futureVersion(),
                             cctx.deploymentEnabled());
@@ -743,7 +743,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
-                    for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+                    for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
                         GridNearAtomicUpdateResponseInterface res0 = req0.response();
 
                         assert res0 != null : req0;
@@ -827,7 +827,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                         req.futureVersion(),
                         cctx.deploymentEnabled());
                 else
-                    res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                    res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
                         req.nodeId(),
                         req.futureVersion(),
                         cctx.deploymentEnabled());
@@ -854,7 +854,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
             Exception err = null;
             GridNearAtomicUpdateRequestInterface singleReq0 = null;
-            Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
+            Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings0 = null;
 
             int size = keys.size();
 
@@ -883,7 +883,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     singleReq0 = mapSingleUpdate(topVer, topNodes, futVer, updVer);
                 }
                 else {
-                    Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
+                    Map<UUID, GridNearAtomicMultipleUpdateRequest> pendingMappings = mapUpdate(topNodes,
                         topVer,
                         futVer,
                         updVer,
@@ -895,7 +895,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                         if (syncMode == PRIMARY_SYNC) {
                             mappings0 = U.newHashMap(pendingMappings.size());
 
-                            for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
+                            for (GridNearAtomicMultipleUpdateRequest req : pendingMappings.values()) {
                                 if (req.hasPrimary())
                                     mappings0.put(req.nodeId(), req);
                             }
@@ -1006,7 +1006,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @throws Exception If failed.
          */
         @SuppressWarnings("ConstantConditions")
-        private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+        private Map<UUID, GridNearAtomicMultipleUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
             AffinityTopologyVersion topVer,
             GridCacheVersion futVer,
             @Nullable GridCacheVersion updVer,
@@ -1026,7 +1026,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (conflictRmvVals != null)
                 conflictRmvValsIt = conflictRmvVals.iterator();
 
-            Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+            Map<UUID, GridNearAtomicMultipleUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
 
             // Create mappings first, then send messages.
             for (Object key : keys) {
@@ -1094,10 +1094,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
                     UUID nodeId = affNode.id();
 
-                    GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
+                    GridNearAtomicMultipleUpdateRequest mapped = pendingMappings.get(nodeId);
 
                     if (mapped == null) {
-                        mapped = new GridNearAtomicUpdateRequest(
+                        mapped = new GridNearAtomicMultipleUpdateRequest(
                             cctx.cacheId(),
                             nodeId,
                             futVer,
@@ -1238,7 +1238,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     cctx.deploymentEnabled());
             }
             else {
-                GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+                GridNearAtomicMultipleUpdateRequest req = new GridNearAtomicMultipleUpdateRequest(
                     cctx.cacheId(),
                     primary.id(),
                     futVer,


[18/51] [abbrv] ignite git commit: IGNITE-2523: Minors.

Posted by vo...@apache.org.
IGNITE-2523: Minors.


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

Branch: refs/heads/ignite-2523
Commit: a18c352748a86ac9e48885f1b6ae93ff9ed4f4dd
Parents: 11a27f7
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Feb 5 10:09:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 5 10:09:48 2016 +0300

----------------------------------------------------------------------
 .../distributed/dht/atomic/GridNearAtomicUpdateFuture.java  | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a18c3527/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 879f9f3..c1dab93 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
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedExce
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheMvccManager;
 import org.apache.ignite.internal.processors.cache.GridCacheOperation;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
@@ -465,13 +466,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                 if (log.isDebugEnabled())
                     log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
 
-                if (req instanceof GridNearAtomicMultipleUpdateRequest)
-                    cctx.io().send(req.nodeId(), (GridNearAtomicMultipleUpdateRequest)req, cctx.ioPolicy());
-                else {
-                    assert req instanceof GridNearAtomicSingleUpdateRequest;
-
-                    cctx.io().send(req.nodeId(), (GridNearAtomicSingleUpdateRequest)req, cctx.ioPolicy());
-                }
+                cctx.io().send(req.nodeId(), (GridCacheMessage)req, cctx.ioPolicy());
 
                 if (syncMode == FULL_ASYNC)
                     onDone(new GridCacheReturn(cctx, true, true, null, true));


[16/51] [abbrv] ignite git commit: IGNITE-2523: Renamings.

Posted by vo...@apache.org.
IGNITE-2523: Renamings.


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

Branch: refs/heads/ignite-2523
Commit: 1491c1f494e47618191ae7e4f79c67a5fdd9a326
Parents: e834080
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Feb 5 10:04:04 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 5 10:04:04 2016 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |    4 +-
 .../processors/cache/GridCacheIoManager.java    |    4 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   40 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |    8 +-
 .../GridNearAtomicMultipleUpdateRequest.java    |  976 +++++++++++++++++
 .../GridNearAtomicSingleUpdateRequest.java      |    2 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   54 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java | 1037 +++---------------
 .../atomic/GridNearAtomicUpdateRequestBase.java |  199 ----
 .../distributed/near/GridNearAtomicCache.java   |    4 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |    6 +-
 .../IgniteCacheAtomicStopBusySelfTest.java      |   10 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   22 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    2 +-
 14 files changed, 1184 insertions(+), 1184 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 25e07b8..88e34c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -69,7 +69,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDh
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -363,7 +363,7 @@ public class GridIoMessageFactory implements MessageFactory {
                 break;
 
             case 40:
-                msg = new GridNearAtomicUpdateRequest();
+                msg = new GridNearAtomicMultipleUpdateRequest();
 
                 break;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 57545af..8a8f161 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -45,7 +45,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartition
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -410,7 +410,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 40: {
-                GridNearAtomicUpdateRequest req = (GridNearAtomicUpdateRequest)msg;
+                GridNearAtomicMultipleUpdateRequest req = (GridNearAtomicMultipleUpdateRequest)msg;
 
                 GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
                     ctx.cacheId(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 40494c1..55db70a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -139,7 +139,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Integer.getInteger(IGNITE_ATOMIC_DEFERRED_ACK_TIMEOUT, 500);
 
     /** Update reply closure. */
-    private CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> updateReplyClos;
+    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
 
     /** Pending  */
     private ConcurrentMap<UUID, DeferredResponseBuffer> pendingResponses = new ConcurrentHashMap8<>();
@@ -192,9 +192,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        updateReplyClos = new CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse>() {
+        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-            @Override public void apply(GridNearAtomicUpdateRequestBase req, GridNearAtomicUpdateResponse res) {
+            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
                 if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
                     assert req.writeSynchronizationMode() != FULL_ASYNC : req;
 
@@ -250,8 +250,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateRequest.class, new CI2<UUID, GridNearAtomicUpdateRequest>() {
-            @Override public void apply(UUID nodeId, GridNearAtomicUpdateRequest req) {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateRequest.class, new CI2<UUID, GridNearAtomicMultipleUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateRequest req) {
                 processNearAtomicUpdateRequest(nodeId, req);
             }
         });
@@ -1310,8 +1310,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal(
         final UUID nodeId,
-        final GridNearAtomicUpdateRequestBase req,
-        final CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb
+        final GridNearAtomicUpdateRequest req,
+        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
@@ -1335,8 +1335,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal0(
         UUID nodeId,
-        GridNearAtomicUpdateRequestBase req,
-        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb
+        GridNearAtomicUpdateRequest req,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
         GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
             ctx.deploymentEnabled());
@@ -1558,12 +1558,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateBatchResult updateWithBatch(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequestBase req,
+        GridNearAtomicUpdateRequest req,
         GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -1974,12 +1974,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateSingleResult updateSingle(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequestBase req,
+        GridNearAtomicUpdateRequest req,
         GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2214,8 +2214,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable Collection<KeyCacheObject> rmvKeys,
         @Nullable Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
-        final GridNearAtomicUpdateRequestBase req,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        final GridNearAtomicUpdateRequest req,
         final GridNearAtomicUpdateResponse res,
         boolean replicate,
         UpdateBatchResult batchRes,
@@ -2593,7 +2593,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      *      will return false.
      * @return {@code True} if filter evaluation succeeded.
      */
-    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequestBase req,
+    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
         GridNearAtomicUpdateResponse res) {
         try {
             return ctx.isAllLocked(entry, req.filter());
@@ -2608,7 +2608,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /**
      * @param req Request to remap.
      */
-    private void remapToNewPrimary(GridNearAtomicUpdateRequestBase req) {
+    private void remapToNewPrimary(GridNearAtomicUpdateRequest req) {
         assert req.writeSynchronizationMode() == FULL_ASYNC : req;
 
         if (log.isDebugEnabled())
@@ -2687,9 +2687,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequestBase updateReq,
+        GridNearAtomicUpdateRequest updateReq,
         GridNearAtomicUpdateResponse updateRes,
-        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean force
     ) {
         if (!force) {
@@ -2720,7 +2720,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Sender node ID.
      * @param req Near atomic update request.
      */
-    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequestBase req) {
+    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequest req) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 7820832..3a31700 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -77,7 +77,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
 
     /** Completion callback. */
     @GridToStringExclude
-    private final CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb;
+    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
 
     /** Mappings. */
     @GridToStringInclude
@@ -87,7 +87,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
     private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
 
     /** Update request. */
-    private final GridNearAtomicUpdateRequestBase updateReq;
+    private final GridNearAtomicUpdateRequest updateReq;
 
     /** Update response. */
     private final GridNearAtomicUpdateResponse updateRes;
@@ -110,9 +110,9 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public GridDhtAtomicUpdateFuture(
         GridCacheContext cctx,
-        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequestBase updateReq,
+        GridNearAtomicUpdateRequest updateReq,
         GridNearAtomicUpdateResponse updateRes
     ) {
         this.cctx = cctx;

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
new file mode 100644
index 0000000..650d350
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -0,0 +1,976 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+
+/**
+ * Lite DHT cache update request sent from near node to primary node.
+ */
+public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
+    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Target node ID. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Fast map flag. */
+    private boolean fastMap;
+
+    /** Update version. Set to non-null if fastMap is {@code true}. */
+    private GridCacheVersion updateVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+    private boolean topLocked;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Update operation. */
+    private GridCacheOperation op;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** Conflict TTLs. */
+    private GridLongList conflictTtls;
+
+    /** Conflict expire times. */
+    private GridLongList conflictExpireTimes;
+
+    /** Return value flag. */
+    private boolean retval;
+
+    /** Expiry policy. */
+    @GridDirectTransient
+    private ExpiryPolicy expiryPlc;
+
+    /** Expiry policy bytes. */
+    private byte[] expiryPlcBytes;
+
+    /** Filter. */
+    private CacheEntryPredicate[] filter;
+
+    /** Flag indicating whether request contains primary keys. */
+    private boolean hasPrimary;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Skip write-through to a persistent storage. */
+    private boolean skipStore;
+
+    /** */
+    private boolean clientReq;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /** */
+    @GridDirectTransient
+    private GridNearAtomicUpdateResponse res;
+
+    /** Maximum possible size of inner collections. */
+    @GridDirectTransient
+    private int initSize;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicMultipleUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param fastMap Fast map scheme flag.
+     * @param updateVer Update version set if fast map is performed.
+     * @param topVer Topology version.
+     * @param topLocked Topology locked flag.
+     * @param syncMode Synchronization mode.
+     * @param op Cache update operation.
+     * @param retval Return value required flag.
+     * @param expiryPlc Expiry policy.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param filter Optional filter for atomic check.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param skipStore Skip write-through to a persistent storage.
+     * @param keepBinary Keep binary flag.
+     * @param clientReq Client node request flag.
+     * @param addDepInfo Deployment info flag.
+     * @param maxEntryCnt Maximum entries count.
+     */
+    public GridNearAtomicMultipleUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        boolean fastMap,
+        @Nullable GridCacheVersion updateVer,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean topLocked,
+        CacheWriteSynchronizationMode syncMode,
+        GridCacheOperation op,
+        boolean retval,
+        @Nullable ExpiryPolicy expiryPlc,
+        @Nullable Object[] invokeArgs,
+        @Nullable CacheEntryPredicate[] filter,
+        @Nullable UUID subjId,
+        int taskNameHash,
+        boolean skipStore,
+        boolean keepBinary,
+        boolean clientReq,
+        boolean addDepInfo,
+        int maxEntryCnt
+    ) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.fastMap = fastMap;
+        this.updateVer = updateVer;
+
+        this.topVer = topVer;
+        this.topLocked = topLocked;
+        this.syncMode = syncMode;
+        this.op = op;
+        this.retval = retval;
+        this.expiryPlc = expiryPlc;
+        this.invokeArgs = invokeArgs;
+        this.filter = filter;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.skipStore = skipStore;
+        this.keepBinary = keepBinary;
+        this.clientReq = clientReq;
+        this.addDepInfo = addDepInfo;
+
+        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
+        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
+        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
+        // than 10, we use it.
+        initSize = Math.min(maxEntryCnt, 10);
+
+        keys = new ArrayList<>(initSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean fastMap() {
+        return fastMap;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion updateVersion() {
+        return updateVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean topologyLocked() {
+        return topLocked;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean clientRequest() {
+        return clientReq;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ExpiryPolicy expiry() {
+        return expiryPlc;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean returnValue() {
+        return retval;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public CacheEntryPredicate[] filter() {
+        return filter;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean skipStore() {
+        return skipStore;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /**
+     * @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).
+     * @param primary If given key is primary on this mapping.
+     */
+    @SuppressWarnings("unchecked")
+    public void addUpdateEntry(KeyCacheObject key,
+        @Nullable Object val,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean primary) {
+        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;
+
+        keys.add(key);
+
+        if (entryProcessor != null) {
+            if (entryProcessors == null)
+                entryProcessors = new ArrayList<>(initSize);
+
+            entryProcessors.add(entryProcessor);
+        }
+        else if (val != null) {
+            assert val instanceof CacheObject : val;
+
+            if (vals == null)
+                vals = new ArrayList<>(initSize);
+
+            vals.add((CacheObject)val);
+        }
+
+        hasPrimary |= primary;
+
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>(initSize);
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictVers.add(null);
+            }
+
+            conflictVers.add(conflictVer);
+        }
+        else if (conflictVers != null)
+            conflictVers.add(null);
+
+        if (conflictTtl >= 0) {
+            if (conflictTtls == null) {
+                conflictTtls = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictTtls.add(CU.TTL_NOT_CHANGED);
+            }
+
+            conflictTtls.add(conflictTtl);
+        }
+
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+
+            conflictExpireTimes.add(conflictExpireTime);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<KeyCacheObject> keys() {
+        return keys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<?> values() {
+        return op == TRANSFORM ? entryProcessors : vals;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheOperation operation() {
+        return op;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public CacheObject value(int idx) {
+        assert op == UPDATE : op;
+
+        return vals.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        assert op == TRANSFORM : op;
+
+        return entryProcessors.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheObject writeValue(int idx) {
+        if (vals != null)
+            return vals.get(idx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
+        return conflictVers;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
+
+            return conflictVers.get(idx);
+        }
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictTtl(int idx) {
+        if (conflictTtls != null) {
+            assert idx >= 0 && idx < conflictTtls.size();
+
+            return conflictTtls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
+
+            return conflictExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean hasPrimary() {
+        return hasPrimary;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+        if (this.res == null) {
+            this.res = res;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(keys, cctx);
+
+        if (filter != null) {
+            boolean hasFilter = false;
+
+            for (CacheEntryPredicate p : filter) {
+                if (p != null) {
+                    hasFilter = true;
+
+                    p.prepareMarshal(cctx);
+                }
+            }
+
+            if (!hasFilter)
+                filter = null;
+        }
+
+        if (expiryPlc != null && expiryPlcBytes == null)
+            expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+
+        if (op == TRANSFORM) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (entryProcessorsBytes == null)
+                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+        }
+        else
+            prepareMarshalCacheObjects(vals, cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+        if (op == TRANSFORM) {
+            if (entryProcessors == null)
+                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+        }
+        else
+            finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+        if (filter != null) {
+            for (CacheEntryPredicate p : filter) {
+                if (p != null)
+                    p.finishUnmarshal(cctx, ldr);
+            }
+        }
+
+        if (expiryPlcBytes != null && expiryPlc == null)
+            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeBoolean("clientReq", clientReq))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("conflictTtls", conflictTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("fastMap", fastMap))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeBoolean("hasPrimary", hasPrimary))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeBoolean("retval", retval))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeBoolean("skipStore", skipStore))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeBoolean("topLocked", topLocked))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("updateVer", updateVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 25:
+                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                clientReq = reader.readBoolean("clientReq");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                conflictTtls = reader.readMessage("conflictTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                fastMap = reader.readBoolean("fastMap");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                hasPrimary = reader.readBoolean("hasPrimary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                byte opOrd;
+
+                opOrd = reader.readByte("op");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                op = GridCacheOperation.fromOrdinal(opOrd);
+
+                reader.incrementState();
+
+            case 17:
+                retval = reader.readBoolean("retval");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                skipStore = reader.readBoolean("skipStore");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 19:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 21:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                topLocked = reader.readBoolean("topLocked");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                updateVer = reader.readMessage("updateVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 25:
+                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicMultipleUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 40;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 26;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicMultipleUpdateRequest.class, this, "filter", Arrays.toString(filter),
+            "parent", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/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 1c30482..1e981af 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
@@ -57,7 +57,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestBase, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/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 f894551..879f9f3 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
@@ -348,7 +348,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param req Update request.
      * @param res Update response.
      */
-    private void updateNear(GridNearAtomicUpdateRequestBase req, GridNearAtomicUpdateResponse res) {
+    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
         assert nearEnabled;
 
         if (res.remapKeys() != null || !req.hasPrimary())
@@ -450,11 +450,11 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param req Request.
      */
-    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequestBase req) {
+    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequestBase req,
+                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicUpdateRequest req,
                         GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
@@ -465,8 +465,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                 if (log.isDebugEnabled())
                     log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
 
-                if (req instanceof GridNearAtomicUpdateRequest)
-                    cctx.io().send(req.nodeId(), (GridNearAtomicUpdateRequest)req, cctx.ioPolicy());
+                if (req instanceof GridNearAtomicMultipleUpdateRequest)
+                    cctx.io().send(req.nodeId(), (GridNearAtomicMultipleUpdateRequest)req, cctx.ioPolicy());
                 else {
                     assert req instanceof GridNearAtomicSingleUpdateRequest;
 
@@ -487,13 +487,13 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      *
      * @param mappings Mappings to send.
      */
-    private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
+    private void doUpdate(Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings) {
         UUID locNodeId = cctx.localNodeId();
 
-        GridNearAtomicUpdateRequest locUpdate = null;
+        GridNearAtomicMultipleUpdateRequest locUpdate = null;
 
         // Send messages to remote nodes first, then run local update.
-        for (GridNearAtomicUpdateRequest req : mappings.values()) {
+        for (GridNearAtomicMultipleUpdateRequest req : mappings.values()) {
             if (locNodeId.equals(req.nodeId())) {
                 assert locUpdate == null : "Cannot have more than one local mapping [locUpdate=" + locUpdate +
                     ", req=" + req + ']';
@@ -515,8 +515,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+                new CI2<GridNearAtomicMultipleUpdateRequest, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicMultipleUpdateRequest req, GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -541,7 +541,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         /** Mappings if operations is mapped to more than one node. */
         @GridToStringInclude
-        private Map<UUID, GridNearAtomicUpdateRequest> mappings;
+        private Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings;
 
         /** */
         private int resCnt;
@@ -559,7 +559,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         private Collection<KeyCacheObject> remapKeys;
 
         /** Not null is operation is mapped to single node. */
-        private GridNearAtomicUpdateRequestBase singleReq;
+        private GridNearAtomicUpdateRequest singleReq;
 
         /** Operation result. */
         private GridCacheReturn opRes;
@@ -578,7 +578,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             GridNearAtomicUpdateResponse res = null;
 
             synchronized (this) {
-                GridNearAtomicUpdateRequestBase req;
+                GridNearAtomicUpdateRequest req;
 
                 if (singleReq != null)
                     req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
@@ -611,7 +611,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          */
         @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
         void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
-            GridNearAtomicUpdateRequestBase req;
+            GridNearAtomicUpdateRequest req;
 
             AffinityTopologyVersion remapTopVer = null;
 
@@ -741,7 +741,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
-                    for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+                    for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
                         GridNearAtomicUpdateResponse res0 = req0.response();
 
                         assert res0 != null : req0;
@@ -815,7 +815,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param req Request.
          * @param e Error.
          */
-        void onSendError(GridNearAtomicUpdateRequestBase req, IgniteCheckedException e) {
+        void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
             synchronized (this) {
                 GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
                     req.nodeId(),
@@ -843,8 +843,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             }
 
             Exception err = null;
-            GridNearAtomicUpdateRequestBase singleReq0 = null;
-            Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
+            GridNearAtomicUpdateRequest singleReq0 = null;
+            Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings0 = null;
 
             int size = keys.size();
 
@@ -873,7 +873,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     singleReq0 = mapSingleUpdate(topVer, topNodes, futVer, updVer);
                 }
                 else {
-                    Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
+                    Map<UUID, GridNearAtomicMultipleUpdateRequest> pendingMappings = mapUpdate(topNodes,
                         topVer,
                         futVer,
                         updVer,
@@ -885,7 +885,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                         if (syncMode == PRIMARY_SYNC) {
                             mappings0 = U.newHashMap(pendingMappings.size());
 
-                            for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
+                            for (GridNearAtomicMultipleUpdateRequest req : pendingMappings.values()) {
                                 if (req.hasPrimary())
                                     mappings0.put(req.nodeId(), req);
                             }
@@ -996,7 +996,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @throws Exception If failed.
          */
         @SuppressWarnings("ConstantConditions")
-        private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+        private Map<UUID, GridNearAtomicMultipleUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
             AffinityTopologyVersion topVer,
             GridCacheVersion futVer,
             @Nullable GridCacheVersion updVer,
@@ -1016,7 +1016,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (conflictRmvVals != null)
                 conflictRmvValsIt = conflictRmvVals.iterator();
 
-            Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+            Map<UUID, GridNearAtomicMultipleUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
 
             // Create mappings first, then send messages.
             for (Object key : keys) {
@@ -1084,10 +1084,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
                     UUID nodeId = affNode.id();
 
-                    GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
+                    GridNearAtomicMultipleUpdateRequest mapped = pendingMappings.get(nodeId);
 
                     if (mapped == null) {
-                        mapped = new GridNearAtomicUpdateRequest(
+                        mapped = new GridNearAtomicMultipleUpdateRequest(
                             cctx.cacheId(),
                             nodeId,
                             futVer,
@@ -1128,7 +1128,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @return Request.
          * @throws Exception If failed.
          */
-        private GridNearAtomicUpdateRequestBase mapSingleUpdate(AffinityTopologyVersion topVer,
+        private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
             Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer)
             throws Exception {
             Object key = F.first(keys);
@@ -1226,7 +1226,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     cctx.deploymentEnabled());
             }
             else {
-                GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+                GridNearAtomicMultipleUpdateRequest req = new GridNearAtomicMultipleUpdateRequest(
                     cctx.cacheId(),
                     primary.id(),
                     futVer,


[36/51] [abbrv] ignite git commit: Merge branches 'ignite-2523' and 'master' of https://github.com/ilantukh/ignite into ignite-2523

Posted by vo...@apache.org.
Merge branches 'ignite-2523' and 'master' of https://github.com/ilantukh/ignite into ignite-2523

Conflicts:
	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java


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

Branch: refs/heads/ignite-2523
Commit: 4318860f36c2339fdb123c9e483341e8707f4ad6
Parents: 9533cb2
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Thu Feb 25 12:11:45 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Thu Feb 25 12:11:45 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicMultipleUpdateResponse.java           | 3 ++-
 .../distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java | 3 ++-
 .../dht/atomic/GridNearAtomicMultipleUpdateRequest.java           | 3 ++-
 .../dht/atomic/GridNearAtomicMultipleUpdateResponse.java          | 3 ++-
 .../distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java | 3 ++-
 .../dht/atomic/GridNearAtomicSingleUpdateResponse.java            | 3 ++-
 6 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4318860f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
index cd0b9a6..5d26610 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -180,7 +181,7 @@ public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implem
         finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
 
         if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, ldr);
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/4318860f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index 044efa9..4930968 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -170,7 +171,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
         finishUnmarshalCacheObject(nearEvicted, cctx, ldr);
 
         if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, ldr);
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/4318860f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index 86de2e2..d702202 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -44,6 +44,7 @@ import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -584,7 +585,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
         }
 
         if (expiryPlcBytes != null && expiryPlc == null)
-            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, ldr);
+            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/4318860f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
index d22acc4..da6d061 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -414,7 +415,7 @@ public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage imple
         super.finishUnmarshal(ctx, ldr);
 
         if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, ldr);
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4318860f/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 94a586d..61889e3 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
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -509,7 +510,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         }
 
         if (expiryPlcBytes != null && expiryPlc == null)
-            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, ldr);
+            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/4318860f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index d6eabd4..9319b64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -389,7 +390,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
         super.finishUnmarshal(ctx, ldr);
 
         if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, ldr);
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 


[06/51] [abbrv] ignite git commit: IGNITE-2532: Reverting changes to GridNearAtomicUpdateFuture.

Posted by vo...@apache.org.
IGNITE-2532: Reverting changes to GridNearAtomicUpdateFuture.


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

Branch: refs/heads/ignite-2523
Commit: 07c23931f9758497db50bf0851af5d6c0fb8eaa4
Parents: 89c8074
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 12:45:42 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 12:45:42 2016 +0300

----------------------------------------------------------------------
 .../GridNearAbstractAtomicUpdateFuture.java     |  252 ----
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 1400 ++++++++++--------
 2 files changed, 798 insertions(+), 854 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/07c23931/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
deleted file mode 100644
index f8c6810..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
-import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheMvccManager;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteProductVersion;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.expiry.ExpiryPolicy;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-
-/**
- * Base class for near atomic update futures.
- */
-public abstract class GridNearAbstractAtomicUpdateFuture extends GridFutureAdapter<Object>
-    implements GridCacheAtomicFuture<Object> {
-    /** */
-    public static final IgniteProductVersion SINGLE_PUT_MSG_SINCE = IgniteProductVersion.fromString("1.6.0");
-
-    /** Logger reference. */
-    protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
-    /** Logger. */
-    protected static IgniteLogger log;
-
-    /** Optional arguments for entry processor. */
-    protected Object[] invokeArgs;
-
-    /** Cache context. */
-    protected final GridCacheContext cctx;
-
-    /** Cache. */
-    protected final GridDhtAtomicCache cache;
-
-    /** Update operation. */
-    protected final GridCacheOperation op;
-
-    /** Return value require flag. */
-    protected final boolean retval;
-
-    /** Expiry policy. */
-    protected final ExpiryPolicy expiryPlc;
-
-    /** Optional filter. */
-    protected final CacheEntryPredicate[] filter;
-
-    /** Write synchronization mode. */
-    protected final CacheWriteSynchronizationMode syncMode;
-
-    /** Raw return value flag. */
-    protected final boolean rawRetval;
-
-    /** Fast map flag. */
-    protected final boolean fastMap;
-
-    /** Near cache flag. */
-    protected final boolean nearEnabled;
-
-    /** Subject ID. */
-    protected final UUID subjId;
-
-    /** Task name hash. */
-    protected final int taskNameHash;
-
-    /** Skip store flag. */
-    protected final boolean skipStore;
-
-    /** */
-    protected final boolean keepBinary;
-
-    /** Wait for topology future flag. */
-    protected final boolean waitTopFut;
-
-    /** Topology locked flag. Set if atomic update is performed inside a TX or explicit lock. */
-    protected boolean topLocked;
-
-    /** Remap count. */
-    protected int remapCnt;
-
-    /**
-     * @param cctx Cache context.
-     * @param cache Cache instance.
-     * @param syncMode Write synchronization mode.
-     * @param op Update operation.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param retval Return value require flag.
-     * @param rawRetval {@code True} if should return {@code GridCacheReturn} as future result.
-     * @param expiryPlc Expiry policy explicitly specified for cache operation.
-     * @param filter Entry filter.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param skipStore Skip store flag.
-     * @param keepBinary Keep binary flag.
-     * @param remapCnt Maximum number of retries.
-     * @param waitTopFut If {@code false} does not wait for affinity change future.
-     */
-    public GridNearAbstractAtomicUpdateFuture(
-        GridCacheContext cctx,
-        GridDhtAtomicCache cache,
-        CacheWriteSynchronizationMode syncMode,
-        GridCacheOperation op,
-        @Nullable Object[] invokeArgs,
-        final boolean retval,
-        final boolean rawRetval,
-        @Nullable ExpiryPolicy expiryPlc,
-        final CacheEntryPredicate[] filter,
-        UUID subjId,
-        int taskNameHash,
-        boolean skipStore,
-        boolean keepBinary,
-        int remapCnt,
-        boolean waitTopFut
-    ) {
-        this.rawRetval = rawRetval;
-
-        assert subjId != null;
-
-        this.cctx = cctx;
-        this.cache = cache;
-        this.syncMode = syncMode;
-        this.op = op;
-        this.invokeArgs = invokeArgs;
-        this.retval = retval;
-        this.expiryPlc = expiryPlc;
-        this.filter = filter;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.skipStore = skipStore;
-        this.keepBinary = keepBinary;
-        this.waitTopFut = waitTopFut;
-
-        if (log == null)
-            log = U.logger(cctx.kernalContext(), logRef, GridFutureAdapter.class);
-
-        fastMap = F.isEmpty(filter) && op != TRANSFORM && cctx.config().getWriteSynchronizationMode() == FULL_SYNC &&
-            cctx.config().getAtomicWriteOrderMode() == CLOCK &&
-            !(cctx.writeThrough() && cctx.config().getInterceptor() != null);
-
-        nearEnabled = CU.isNearEnabled(cctx);
-
-        if (!waitTopFut)
-            remapCnt = 1;
-
-        this.remapCnt = remapCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteUuid futureId() {
-        throw new UnsupportedOperationException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean trackable() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void markNotTrackable() {
-        // No-op.
-    }
-
-    /**
-     * @return {@code True} if this future should block partition map exchange.
-     */
-    protected boolean waitForPartitionExchange() {
-        // Wait fast-map near atomic update futures in CLOCK mode.
-        return fastMap;
-    }
-
-    /**
-     * Updates near cache.
-     *
-     * @param req Update request.
-     * @param res Update response.
-     */
-    protected void updateNear(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponse res) {
-        assert nearEnabled;
-
-        if (res.remapKeys() != null || !req.hasPrimary())
-            return;
-
-        GridNearAtomicCache near = (GridNearAtomicCache)cctx.dht().near();
-
-        near.processNearAtomicUpdateResponse(req, res);
-    }
-
-    /**
-     * @return {@code True} future is stored by {@link GridCacheMvccManager#addAtomicFuture}.
-     */
-    protected boolean storeFuture() {
-        return cctx.config().getAtomicWriteOrderMode() == CLOCK || syncMode != FULL_ASYNC;
-    }
-
-    /**
-     * Maps key to nodes. If filters are absent and operation is not TRANSFORM, then we can assign version on near
-     * node and send updates in parallel to all participating nodes.
-     *
-     * @param key Key to map.
-     * @param topVer Topology version to map.
-     * @param fastMap Flag indicating whether mapping is performed for fast-circuit update.
-     * @return Collection of nodes to which key is mapped.
-     */
-    protected Collection<ClusterNode> mapKey(KeyCacheObject key, AffinityTopologyVersion topVer, boolean fastMap
-    ) {
-        GridCacheAffinityManager affMgr = cctx.affinity();
-
-        // If we can send updates in parallel - do it.
-        return fastMap ?
-            cctx.topology().nodes(affMgr.partition(key), topVer) :
-            Collections.singletonList(affMgr.primary(key, topVer));
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/07c23931/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 c8550f3..149d277 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
@@ -17,7 +17,16 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInternalFuture;
@@ -26,12 +35,16 @@ import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
 import org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException;
+import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
+import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMvccManager;
 import org.apache.ignite.internal.processors.cache.GridCacheOperation;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheTryPutFailedException;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -44,26 +57,38 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteProductVersion;
+import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
-import javax.cache.expiry.ExpiryPolicy;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-
 import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
 import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
 
 /**
  * DHT atomic cache near update future.
  */
-@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFuture {
+public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implements GridCacheAtomicFuture<Object>{
+    /** Version where single-put optimization appeared.*/
+    public static final IgniteProductVersion SINGLE_PUT_MSG_SINCE = IgniteProductVersion.fromString("1.6.0");
+
+    /** Logger reference. */
+    private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+    /** Logger. */
+    protected static IgniteLogger log;
+
+    /** Cache context. */
+    private final GridCacheContext cctx;
+
+    /** Cache. */
+    private GridDhtAtomicCache cache;
+
+    /** Update operation. */
+    private final GridCacheOperation op;
+
     /** Keys */
     private Collection<?> keys;
 
@@ -71,6 +96,9 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     private Collection<?> vals;
 
+    /** Optional arguments for entry processor. */
+    private Object[] invokeArgs;
+
     /** Conflict put values. */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     private Collection<GridCacheDrInfo> conflictPutVals;
@@ -79,39 +107,50 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     private Collection<GridCacheVersion> conflictRmvVals;
 
-    /** Current topology version. */
-    private AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
+    /** Return value require flag. */
+    private final boolean retval;
 
-    /** */
-    private GridCacheVersion updVer;
+    /** Expiry policy. */
+    private final ExpiryPolicy expiryPlc;
 
-    /** Topology version when got mapping error. */
-    private AffinityTopologyVersion mapErrTopVer;
+    /** Optional filter. */
+    private final CacheEntryPredicate[] filter;
 
-    /** Mappings if operations is mapped to more than one node. */
-    @GridToStringInclude
-    private Map<UUID, GridNearAtomicUpdateRequest> mappings;
+    /** Write synchronization mode. */
+    private final CacheWriteSynchronizationMode syncMode;
 
-    /** */
-    private int resCnt;
+    /** Raw return value flag. */
+    private final boolean rawRetval;
+
+    /** Fast map flag. */
+    private final boolean fastMap;
+
+    /** Near cache flag. */
+    private final boolean nearEnabled;
 
-    /** Error. */
-    private CachePartialUpdateCheckedException err;
+    /** Subject ID. */
+    private final UUID subjId;
 
-    /** Future ID. */
-    private GridCacheVersion futVer;
+    /** Task name hash. */
+    private final int taskNameHash;
 
-    /** Completion future for a particular topology version. */
-    private GridFutureAdapter<Void> topCompleteFut;
+    /** Topology locked flag. Set if atomic update is performed inside a TX or explicit lock. */
+    private boolean topLocked;
+
+    /** Skip store flag. */
+    private final boolean skipStore;
+
+    /** */
+    private final boolean keepBinary;
 
-    /** Keys to remap. */
-    private Collection<KeyCacheObject> remapKeys;
+    /** Wait for topology future flag. */
+    private final boolean waitTopFut;
 
-    /** Not null is operation is mapped to single node. */
-    private GridNearAtomicUpdateRequestInterface singleReq;
+    /** Remap count. */
+    private int remapCnt;
 
-    /** Operation result. */
-    private GridCacheReturn opRes;    
+    /** State. */
+    private final UpdateState state;
 
     /**
      * @param cctx Cache context.
@@ -155,72 +194,116 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
         int remapCnt,
         boolean waitTopFut
     ) {
-        super(cctx, cache, syncMode, op, invokeArgs, retval, rawRetval, expiryPlc, filter, subjId, taskNameHash,
-            skipStore, keepBinary, remapCnt, waitTopFut);
+        this.rawRetval = rawRetval;
 
         assert vals == null || vals.size() == keys.size();
         assert conflictPutVals == null || conflictPutVals.size() == keys.size();
         assert conflictRmvVals == null || conflictRmvVals.size() == keys.size();
+        assert subjId != null;
 
+        this.cctx = cctx;
+        this.cache = cache;
+        this.syncMode = syncMode;
+        this.op = op;
         this.keys = keys;
         this.vals = vals;
+        this.invokeArgs = invokeArgs;
         this.conflictPutVals = conflictPutVals;
         this.conflictRmvVals = conflictRmvVals;
+        this.retval = retval;
+        this.expiryPlc = expiryPlc;
+        this.filter = filter;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.skipStore = skipStore;
+        this.keepBinary = keepBinary;
+        this.waitTopFut = waitTopFut;
+
+        if (log == null)
+            log = U.logger(cctx.kernalContext(), logRef, GridFutureAdapter.class);
+
+        fastMap = F.isEmpty(filter) && op != TRANSFORM && cctx.config().getWriteSynchronizationMode() == FULL_SYNC &&
+            cctx.config().getAtomicWriteOrderMode() == CLOCK &&
+            !(cctx.writeThrough() && cctx.config().getInterceptor() != null);
+
+        nearEnabled = CU.isNearEnabled(cctx);
+
+        if (!waitTopFut)
+            remapCnt = 1;
+
+        this.remapCnt = remapCnt;
+
+        state = new UpdateState();
     }
 
     /** {@inheritDoc} */
-    @Override public synchronized GridCacheVersion version() {
-        return futVer;
+    @Override public IgniteUuid futureId() {
+        throw new UnsupportedOperationException();
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
-        if (waitForPartitionExchange()) {
-            GridFutureAdapter<Void> fut = completeFuture0(topVer);
+    @Override public GridCacheVersion version() {
+        return state.futureVersion();
+    }
 
-            if (fut != null && isDone()) {
-                fut.onDone();
+    /**
+     * @return {@code True} if this future should block partition map exchange.
+     */
+    private boolean waitForPartitionExchange() {
+        // Wait fast-map near atomic update futures in CLOCK mode.
+        return fastMap;
+    }
 
-                return null;
-            }
+    /** {@inheritDoc} */
+    @Override public boolean onNodeLeft(UUID nodeId) {
+        state.onNodeLeft(nodeId);
 
-            return fut;
-        }
+        return false;
+    }
 
-        return null;
+    /** {@inheritDoc} */
+    @Override public boolean trackable() {
+        return true;
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onNodeLeft(UUID nodeId) {
-        GridNearAtomicUpdateResponse res = null;
+    @Override public void markNotTrackable() {
+        // No-op.
+    }
 
-        synchronized (this) {
-            GridNearAtomicUpdateRequestInterface req;
+    /**
+     * Performs future mapping.
+     */
+    public void map() {
+        AffinityTopologyVersion topVer = cctx.shared().lockedTopologyVersion(null);
 
-            if (singleReq != null)
-                req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
-            else
-                req = mappings != null ? mappings.get(nodeId) : null;
+        if (topVer == null)
+            mapOnTopology();
+        else {
+            topLocked = true;
 
-            if (req != null && req.response() == null) {
-                res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
-                    nodeId,
-                    req.futureVersion(),
-                    cctx.deploymentEnabled());
+            // Cannot remap.
+            remapCnt = 1;
 
-                ClusterTopologyCheckedException e = new ClusterTopologyCheckedException("Primary node left grid " +
-                    "before response is received: " + nodeId);
+            state.map(topVer, null);
+        }
+    }
 
-                e.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(req.topologyVersion()));
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
+        if (waitForPartitionExchange()) {
+            GridFutureAdapter<Void> fut = state.completeFuture(topVer);
 
-                res.addFailedKeys(req.keys(), e);
+            if (fut != null && isDone()) {
+                fut.onDone();
+
+                return null;
             }
-        }
 
-        if (res != null)
-            onResult(nodeId, res, true);
+            return fut;
+        }
 
-        return false;
+        return null;
     }
 
     /** {@inheritDoc} */
@@ -238,7 +321,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             retval = Collections.emptyMap();
 
         if (super.onDone(retval, err)) {
-            GridCacheVersion futVer = onFutureDone();
+            GridCacheVersion futVer = state.onFutureDone();
 
             if (futVer != null)
                 cctx.mvcc().removeAtomicFuture(futVer);
@@ -250,31 +333,30 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     }
 
     /**
-     * Performs future mapping.
+     * Response callback.
+     *
+     * @param nodeId Node ID.
+     * @param res Update response.
      */
-    public void map() {
-        AffinityTopologyVersion topVer = cctx.shared().lockedTopologyVersion(null);
-
-        if (topVer == null)
-            mapOnTopology();
-        else {
-            topLocked = true;
-
-            // Cannot remap.
-            remapCnt = 1;
-
-            map(topVer, null);
-        }
+    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
+        state.onResult(nodeId, res, false);
     }
 
     /**
-     * Response callback.
+     * Updates near cache.
      *
-     * @param nodeId Node ID.
+     * @param req Update request.
      * @param res Update response.
      */
-    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
-        onResult(nodeId, res, false);
+    private void updateNear(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponse res) {
+        assert nearEnabled;
+
+        if (res.remapKeys() != null || !req.hasPrimary())
+            return;
+
+        GridNearAtomicCache near = (GridNearAtomicCache)cctx.dht().near();
+
+        near.processNearAtomicUpdateResponse(req, res);
     }
 
     /**
@@ -330,7 +412,36 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             cache.topology().readUnlock();
         }
 
-        map(topVer, null);
+        state.map(topVer, null);
+    }
+
+    /**
+     * @return {@code True} future is stored by {@link GridCacheMvccManager#addAtomicFuture}.
+     */
+    private boolean storeFuture() {
+        return cctx.config().getAtomicWriteOrderMode() == CLOCK || syncMode != FULL_ASYNC;
+    }
+
+    /**
+     * Maps key to nodes. If filters are absent and operation is not TRANSFORM, then we can assign version on near
+     * node and send updates in parallel to all participating nodes.
+     *
+     * @param key Key to map.
+     * @param topVer Topology version to map.
+     * @param fastMap Flag indicating whether mapping is performed for fast-circuit update.
+     * @return Collection of nodes to which key is mapped.
+     */
+    private Collection<ClusterNode> mapKey(
+        KeyCacheObject key,
+        AffinityTopologyVersion topVer,
+        boolean fastMap
+    ) {
+        GridCacheAffinityManager affMgr = cctx.affinity();
+
+        // If we can send updates in parallel - do it.
+        return fastMap ?
+            cctx.topology().nodes(affMgr.partition(key), topVer) :
+            Collections.singletonList(affMgr.primary(key, topVer));
     }
 
     /**
@@ -343,7 +454,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
                 new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponse res) {
+                    @Override public void apply(GridNearAtomicUpdateRequestInterface req,
+                        GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -365,7 +477,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                     onDone(new GridCacheReturn(cctx, true, true, null, true));
             }
             catch (IgniteCheckedException e) {
-                onSendError(req, e);
+                state.onSendError(req, e);
             }
         }
     }
@@ -378,7 +490,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
         UUID locNodeId = cctx.localNodeId();
 
-        GridNearAtomicUpdateRequestInterface locUpdate = null;
+        GridNearAtomicUpdateRequest locUpdate = null;
 
         // Send messages to remote nodes first, then run local update.
         for (GridNearAtomicUpdateRequest req : mappings.values()) {
@@ -396,7 +508,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                     cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
                 }
                 catch (IgniteCheckedException e) {
-                    onSendError(req, e);
+                    state.onSendError(req, e);
                 }
             }
         }
@@ -415,423 +527,611 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     }
 
     /**
-     * @param nodeId Node ID.
-     * @param res Response.
-     * @param nodeErr {@code True} if response was created on node failure.
+     *
      */
-    @SuppressWarnings("unchecked")
-    void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
-        GridNearAtomicUpdateRequestInterface req;
+    private class UpdateState {
+        /** Current topology version. */
+        private AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
 
-        AffinityTopologyVersion remapTopVer = null;
+        /** */
+        private GridCacheVersion updVer;
 
-        GridCacheReturn opRes0 = null;
-        CachePartialUpdateCheckedException err0 = null;
+        /** Topology version when got mapping error. */
+        private AffinityTopologyVersion mapErrTopVer;
 
-        boolean rcvAll;
+        /** Mappings if operations is mapped to more than one node. */
+        @GridToStringInclude
+        private Map<UUID, GridNearAtomicUpdateRequest> mappings;
 
-        GridFutureAdapter<?> fut0 = null;
+        /** */
+        private int resCnt;
 
-        synchronized (this) {
-            if (!res.futureVersion().equals(futVer))
-                return;
+        /** Error. */
+        private CachePartialUpdateCheckedException err;
 
-            if (singleReq != null) {
-                if (!singleReq.nodeId().equals(nodeId))
-                    return;
+        /** Future ID. */
+        private GridCacheVersion futVer;
 
-                req = singleReq;
+        /** Completion future for a particular topology version. */
+        private GridFutureAdapter<Void> topCompleteFut;
 
-                singleReq = null;
+        /** Keys to remap. */
+        private Collection<KeyCacheObject> remapKeys;
 
-                rcvAll = true;
-            }
-            else {
-                req = mappings != null ? mappings.get(nodeId) : null;
+        /** Not null is operation is mapped to single node. */
+        private GridNearAtomicUpdateRequestInterface singleReq;
 
-                if (req != null && req.onResponse(res)) {
-                    resCnt++;
+        /** Operation result. */
+        private GridCacheReturn opRes;
 
-                    rcvAll = mappings.size() == resCnt;
-                }
+        /**
+         * @return Future version.
+         */
+        @Nullable synchronized GridCacheVersion futureVersion() {
+            return futVer;
+        }
+
+        /**
+         * @param nodeId Left node ID.
+         */
+        void onNodeLeft(UUID nodeId) {
+            GridNearAtomicUpdateResponse res = null;
+
+            synchronized (this) {
+                GridNearAtomicUpdateRequestInterface req;
+
+                if (singleReq != null)
+                    req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
                 else
-                    return;
+                    req = mappings != null ? mappings.get(nodeId) : null;
+
+                if (req != null && req.response() == null) {
+                    res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                        nodeId,
+                        req.futureVersion(),
+                        cctx.deploymentEnabled());
+
+                    ClusterTopologyCheckedException e = new ClusterTopologyCheckedException("Primary node left grid " +
+                        "before response is received: " + nodeId);
+
+                    e.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(req.topologyVersion()));
+
+                    res.addFailedKeys(req.keys(), e);
+                }
             }
 
-            assert req != null && req.topologyVersion().equals(topVer) : req;
+            if (res != null)
+                onResult(nodeId, res, true);
+        }
 
-            if (res.remapKeys() != null) {
-                assert !fastMap || cctx.kernalContext().clientNode();
+        /**
+         * @param nodeId Node ID.
+         * @param res Response.
+         * @param nodeErr {@code True} if response was created on node failure.
+         */
+        @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
+        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
+            GridNearAtomicUpdateRequestInterface req;
 
-                if (remapKeys == null)
-                    remapKeys = U.newHashSet(res.remapKeys().size());
+            AffinityTopologyVersion remapTopVer = null;
 
-                remapKeys.addAll(res.remapKeys());
+            GridCacheReturn opRes0 = null;
+            CachePartialUpdateCheckedException err0 = null;
 
-                if (mapErrTopVer == null || mapErrTopVer.compareTo(req.topologyVersion()) < 0)
-                    mapErrTopVer = req.topologyVersion();
-            }
-            else if (res.error() != null) {
-                if (res.failedKeys() != null)
-                    addFailedKeys(res.failedKeys(), req.topologyVersion(), res.error());
-            }
-            else {
-                if (!req.fastMap() || req.hasPrimary()) {
-                    GridCacheReturn ret = res.returnValue();
+            boolean rcvAll;
+
+            GridFutureAdapter<?> fut0 = null;
+
+            synchronized (this) {
+                if (!res.futureVersion().equals(futVer))
+                    return;
+
+                if (singleReq != null) {
+                    if (!singleReq.nodeId().equals(nodeId))
+                        return;
+
+                    req = singleReq;
+
+                    singleReq = null;
+
+                    rcvAll = true;
+                }
+                else {
+                    req = mappings != null ? mappings.get(nodeId) : null;
+
+                    if (req != null && req.onResponse(res)) {
+                        resCnt++;
 
-                    if (op == TRANSFORM) {
-                        if (ret != null)
-                            addInvokeResults(ret);
+                        rcvAll = mappings.size() == resCnt;
                     }
                     else
-                        opRes = ret;
+                        return;
                 }
-            }
 
-            if (rcvAll) {
-                if (remapKeys != null) {
-                    assert mapErrTopVer != null;
+                assert req != null && req.topologyVersion().equals(topVer) : req;
+
+                if (res.remapKeys() != null) {
+                    assert !fastMap || cctx.kernalContext().clientNode();
+
+                    if (remapKeys == null)
+                        remapKeys = U.newHashSet(res.remapKeys().size());
 
-                    remapTopVer = new AffinityTopologyVersion(mapErrTopVer.topologyVersion() + 1);
+                    remapKeys.addAll(res.remapKeys());
+
+                    if (mapErrTopVer == null || mapErrTopVer.compareTo(req.topologyVersion()) < 0)
+                        mapErrTopVer = req.topologyVersion();
+                }
+                else if (res.error() != null) {
+                    if (res.failedKeys() != null)
+                        addFailedKeys(res.failedKeys(), req.topologyVersion(), res.error());
                 }
                 else {
-                    if (err != null &&
-                        X.hasCause(err, CachePartialUpdateCheckedException.class) &&
-                        X.hasCause(err, ClusterTopologyCheckedException.class) &&
-                        storeFuture() &&
-                        --remapCnt > 0) {
-                        ClusterTopologyCheckedException topErr =
-                            X.cause(err, ClusterTopologyCheckedException.class);
+                    if (!req.fastMap() || req.hasPrimary()) {
+                        GridCacheReturn ret = res.returnValue();
+
+                        if (op == TRANSFORM) {
+                            if (ret != null)
+                                addInvokeResults(ret);
+                        }
+                        else
+                            opRes = ret;
+                    }
+                }
+
+                if (rcvAll) {
+                    if (remapKeys != null) {
+                        assert mapErrTopVer != null;
+
+                        remapTopVer = new AffinityTopologyVersion(mapErrTopVer.topologyVersion() + 1);
+                    }
+                    else {
+                        if (err != null &&
+                            X.hasCause(err, CachePartialUpdateCheckedException.class) &&
+                            X.hasCause(err, ClusterTopologyCheckedException.class) &&
+                            storeFuture() &&
+                            --remapCnt > 0) {
+                            ClusterTopologyCheckedException topErr =
+                                X.cause(err, ClusterTopologyCheckedException.class);
 
-                        if (!(topErr instanceof ClusterTopologyServerNotFoundException)) {
-                            CachePartialUpdateCheckedException cause =
-                                X.cause(err, CachePartialUpdateCheckedException.class);
+                            if (!(topErr instanceof ClusterTopologyServerNotFoundException)) {
+                                CachePartialUpdateCheckedException cause =
+                                    X.cause(err, CachePartialUpdateCheckedException.class);
 
-                            assert cause != null && cause.topologyVersion() != null : err;
+                                assert cause != null && cause.topologyVersion() != null : err;
 
-                            remapTopVer =
-                                new AffinityTopologyVersion(cause.topologyVersion().topologyVersion() + 1);
+                                remapTopVer =
+                                    new AffinityTopologyVersion(cause.topologyVersion().topologyVersion() + 1);
 
-                            err = null;
+                                err = null;
 
-                            Collection<Object> failedKeys = cause.failedKeys();
+                                Collection<Object> failedKeys = cause.failedKeys();
 
-                            remapKeys = new ArrayList<>(failedKeys.size());
+                                remapKeys = new ArrayList<>(failedKeys.size());
 
-                            for (Object key : failedKeys)
-                                remapKeys.add(cctx.toCacheKeyObject(key));
+                                for (Object key : failedKeys)
+                                    remapKeys.add(cctx.toCacheKeyObject(key));
 
-                            updVer = null;
+                                updVer = null;
+                            }
                         }
                     }
-                }
 
-                if (remapTopVer == null) {
-                    err0 = err;
-                    opRes0 = opRes;
-                }
-                else {
-                    fut0 = topCompleteFut;
+                    if (remapTopVer == null) {
+                        err0 = err;
+                        opRes0 = opRes;
+                    }
+                    else {
+                        fut0 = topCompleteFut;
 
-                    topCompleteFut = null;
+                        topCompleteFut = null;
 
-                    cctx.mvcc().removeAtomicFuture(futVer);
+                        cctx.mvcc().removeAtomicFuture(futVer);
 
-                    futVer = null;
-                    topVer = AffinityTopologyVersion.ZERO;
+                        futVer = null;
+                        topVer = AffinityTopologyVersion.ZERO;
+                    }
                 }
             }
-        }
 
-        if (res.error() != null && res.failedKeys() == null) {
-            onDone(res.error());
+            if (res.error() != null && res.failedKeys() == null) {
+                onDone(res.error());
 
-            return;
-        }
+                return;
+            }
 
-        if (rcvAll && nearEnabled) {
-            if (mappings != null) {
-                for (GridNearAtomicUpdateRequestInterface req0 : mappings.values()) {
-                    GridNearAtomicUpdateResponse res0 = req0.response();
+            if (rcvAll && nearEnabled) {
+                if (mappings != null) {
+                    for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+                        GridNearAtomicUpdateResponse res0 = req0.response();
 
-                    assert res0 != null : req0;
+                        assert res0 != null : req0;
 
-                    updateNear(req0, res0);
+                        updateNear(req0, res0);
+                    }
                 }
+                else if (!nodeErr)
+                    updateNear(req, res);
             }
-            else if (!nodeErr)
-                updateNear(req, res);
-        }
 
-        if (remapTopVer != null) {
-            if (fut0 != null)
-                fut0.onDone();
+            if (remapTopVer != null) {
+                if (fut0 != null)
+                    fut0.onDone();
 
-            if (!waitTopFut) {
-                onDone(new GridCacheTryPutFailedException());
+                if (!waitTopFut) {
+                    onDone(new GridCacheTryPutFailedException());
 
-                return;
-            }
+                    return;
+                }
 
-            if (topLocked) {
-                assert !F.isEmpty(remapKeys) : remapKeys;
+                if (topLocked) {
+                    assert !F.isEmpty(remapKeys) : remapKeys;
 
-                CachePartialUpdateCheckedException e =
-                    new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
+                    CachePartialUpdateCheckedException e =
+                        new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
 
-                ClusterTopologyCheckedException cause = new ClusterTopologyCheckedException(
-                    "Failed to update keys, topology changed while execute atomic update inside transaction.");
+                    ClusterTopologyCheckedException cause = new ClusterTopologyCheckedException(
+                        "Failed to update keys, topology changed while execute atomic update inside transaction.");
 
-                cause.retryReadyFuture(cctx.affinity().affinityReadyFuture(remapTopVer));
+                    cause.retryReadyFuture(cctx.affinity().affinityReadyFuture(remapTopVer));
 
-                e.add(remapKeys, cause);
+                    e.add(remapKeys, cause);
 
-                onDone(e);
+                    onDone(e);
 
-                return;
-            }
+                    return;
+                }
 
-            IgniteInternalFuture<AffinityTopologyVersion> fut =
-                cctx.shared().exchange().affinityReadyFuture(remapTopVer);
+                IgniteInternalFuture<AffinityTopologyVersion> fut =
+                    cctx.shared().exchange().affinityReadyFuture(remapTopVer);
 
-            if (fut == null)
-                fut = new GridFinishedFuture<>(remapTopVer);
+                if (fut == null)
+                    fut = new GridFinishedFuture<>(remapTopVer);
 
-            fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
-                @Override public void apply(final IgniteInternalFuture<AffinityTopologyVersion> fut) {
-                    cctx.kernalContext().closure().runLocalSafe(new Runnable() {
-                        @Override public void run() {
-                            try {
-                                AffinityTopologyVersion topVer = fut.get();
+                fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
+                    @Override public void apply(final IgniteInternalFuture<AffinityTopologyVersion> fut) {
+                        cctx.kernalContext().closure().runLocalSafe(new Runnable() {
+                            @Override public void run() {
+                                try {
+                                    AffinityTopologyVersion topVer = fut.get();
 
-                                map(topVer, remapKeys);
-                            }
-                            catch (IgniteCheckedException e) {
-                                onDone(e);
+                                    map(topVer, remapKeys);
+                                }
+                                catch (IgniteCheckedException e) {
+                                    onDone(e);
+                                }
                             }
-                        }
-                    });
-                }
-            });
+                        });
+                    }
+                });
 
-            return;
-        }
+                return;
+            }
 
-        if (rcvAll)
-            onDone(opRes0, err0);
-    }
+            if (rcvAll)
+                onDone(opRes0, err0);
+        }
 
-    /**
-     * @param req Request.
-     * @param e Error.
-     */
-    void onSendError(GridNearAtomicUpdateRequestInterface req, IgniteCheckedException e) {
-        synchronized (this) {
-            GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
-                req.nodeId(),
-                req.futureVersion(),
-                cctx.deploymentEnabled());
+        /**
+         * @param req Request.
+         * @param e Error.
+         */
+        void onSendError(GridNearAtomicUpdateRequestInterface req, IgniteCheckedException e) {
+            synchronized (this) {
+                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
+                    req.nodeId(),
+                    req.futureVersion(),
+                    cctx.deploymentEnabled());
 
-            res.addFailedKeys(req.keys(), e);
+                res.addFailedKeys(req.keys(), e);
 
-            onResult(req.nodeId(), res, true);
+                onResult(req.nodeId(), res, true);
+            }
         }
-    }
 
-    /**
-     * @param topVer Topology version.
-     * @param remapKeys Keys to remap.
-     */
-    void map(AffinityTopologyVersion topVer, @Nullable Collection<KeyCacheObject> remapKeys) {
-        Collection<ClusterNode> topNodes = CU.affinityNodes(cctx, topVer);
+        /**
+         * @param topVer Topology version.
+         * @param remapKeys Keys to remap.
+         */
+        void map(AffinityTopologyVersion topVer, @Nullable Collection<KeyCacheObject> remapKeys) {
+            Collection<ClusterNode> topNodes = CU.affinityNodes(cctx, topVer);
 
-        if (F.isEmpty(topNodes)) {
-            onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
-                "left the grid)."));
+            if (F.isEmpty(topNodes)) {
+                onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
+                    "left the grid)."));
 
-            return;
-        }
+                return;
+            }
 
-        Exception err = null;
-        GridNearAtomicUpdateRequestInterface singleReq0 = null;
-        Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
+            Exception err = null;
+            GridNearAtomicUpdateRequestInterface singleReq0 = null;
+            Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
 
-        int size = keys.size();
+            int size = keys.size();
 
-        GridCacheVersion futVer = cctx.versions().next(topVer);
+            GridCacheVersion futVer = cctx.versions().next(topVer);
 
-        GridCacheVersion updVer;
+            GridCacheVersion updVer;
 
-        // Assign version on near node in CLOCK ordering mode even if fastMap is false.
-        if (cctx.config().getAtomicWriteOrderMode() == CLOCK) {
-            updVer = this.updVer;
+            // Assign version on near node in CLOCK ordering mode even if fastMap is false.
+            if (cctx.config().getAtomicWriteOrderMode() == CLOCK) {
+                updVer = this.updVer;
 
-            if (updVer == null) {
-                updVer = cctx.versions().next(topVer);
+                if (updVer == null) {
+                    updVer = cctx.versions().next(topVer);
 
-                if (log.isDebugEnabled())
-                    log.debug("Assigned fast-map version for update on near node: " + updVer);
+                    if (log.isDebugEnabled())
+                        log.debug("Assigned fast-map version for update on near node: " + updVer);
+                }
             }
-        }
-        else
-            updVer = null;
-
-        try {
-            if (size == 1 && !fastMap) {
-                assert remapKeys == null || remapKeys.size() == 1;
+            else
+                updVer = null;
 
-                singleReq0 = mapSingleUpdate(topVer, topNodes, futVer, updVer);
-            }
-            else {
-                Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
-                    topVer,
-                    futVer,
-                    updVer,
-                    remapKeys);
+            try {
+                if (size == 1 && !fastMap) {
+                    assert remapKeys == null || remapKeys.size() == 1;
 
-                if (pendingMappings.size() == 1)
-                    singleReq0 = F.firstValue(pendingMappings);
+                    singleReq0 = mapSingleUpdate(topVer, topNodes, futVer, updVer);
+                }
                 else {
-                    if (syncMode == PRIMARY_SYNC) {
-                        mappings0 = U.newHashMap(pendingMappings.size());
+                    Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
+                        topVer,
+                        futVer,
+                        updVer,
+                        remapKeys);
 
-                        for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
-                            if (req.hasPrimary())
-                                mappings0.put(req.nodeId(), req);
+                    if (pendingMappings.size() == 1)
+                        singleReq0 = F.firstValue(pendingMappings);
+                    else {
+                        if (syncMode == PRIMARY_SYNC) {
+                            mappings0 = U.newHashMap(pendingMappings.size());
+
+                            for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
+                                if (req.hasPrimary())
+                                    mappings0.put(req.nodeId(), req);
+                            }
                         }
-                    }
-                    else
-                        mappings0 = pendingMappings;
+                        else
+                            mappings0 = pendingMappings;
 
-                    assert !mappings0.isEmpty() || size == 0 : this;
+                        assert !mappings0.isEmpty() || size == 0 : GridNearAtomicUpdateFuture.this;
+                    }
                 }
-            }
 
-            synchronized (this) {
-                assert this.futVer == null : this;
-                assert this.topVer == AffinityTopologyVersion.ZERO : this;
+                synchronized (this) {
+                    assert this.futVer == null : this;
+                    assert this.topVer == AffinityTopologyVersion.ZERO : this;
 
-                this.topVer = topVer;
-                this.updVer = updVer;
-                this.futVer = futVer;
+                    this.topVer = topVer;
+                    this.updVer = updVer;
+                    this.futVer = futVer;
 
-                resCnt = 0;
+                    resCnt = 0;
 
-                singleReq = singleReq0;
-                mappings = mappings0;
+                    singleReq = singleReq0;
+                    mappings = mappings0;
 
-                this.remapKeys = null;
+                    this.remapKeys = null;
+                }
+            }
+            catch (Exception e) {
+                err = e;
             }
-        }
-        catch (Exception e) {
-            err = e;
-        }
 
-        if (err != null) {
-            onDone(err);
+            if (err != null) {
+                onDone(err);
 
-            return;
-        }
+                return;
+            }
 
-        if (storeFuture()) {
-            if (!cctx.mvcc().addAtomicFuture(futVer, this)) {
-                assert isDone() : this;
+            if (storeFuture()) {
+                if (!cctx.mvcc().addAtomicFuture(futVer, GridNearAtomicUpdateFuture.this)) {
+                    assert isDone() : GridNearAtomicUpdateFuture.this;
 
-                return;
+                    return;
+                }
             }
-        }
 
-        // Optimize mapping for single key.
-        if (singleReq0 != null)
-            mapSingle(singleReq0.nodeId(), singleReq0);
-        else {
-            assert mappings0 != null;
+            // Optimize mapping for single key.
+            if (singleReq0 != null)
+                mapSingle(singleReq0.nodeId(), singleReq0);
+            else {
+                assert mappings0 != null;
 
-            if (size == 0)
-                onDone(new GridCacheReturn(cctx, true, true, null, true));
-            else
-                doUpdate(mappings0);
+                if (size == 0)
+                    onDone(new GridCacheReturn(cctx, true, true, null, true));
+                else
+                    doUpdate(mappings0);
+            }
         }
-    }
 
-    /**
-     * @param topVer Topology version.
-     * @return Future.
-     */
-    @Nullable private synchronized GridFutureAdapter<Void> completeFuture0(AffinityTopologyVersion topVer) {
-        if (this.topVer == AffinityTopologyVersion.ZERO)
-            return null;
+        /**
+         * @param topVer Topology version.
+         * @return Future.
+         */
+        @Nullable synchronized GridFutureAdapter<Void> completeFuture(AffinityTopologyVersion topVer) {
+            if (this.topVer == AffinityTopologyVersion.ZERO)
+                return null;
 
-        if (this.topVer.compareTo(topVer) < 0) {
-            if (topCompleteFut == null)
-                topCompleteFut = new GridFutureAdapter<>();
+            if (this.topVer.compareTo(topVer) < 0) {
+                if (topCompleteFut == null)
+                    topCompleteFut = new GridFutureAdapter<>();
 
-            return topCompleteFut;
+                return topCompleteFut;
+            }
+
+            return null;
         }
 
-        return null;
-    }
+        /**
+         * @return Future version.
+         */
+        GridCacheVersion onFutureDone() {
+            GridCacheVersion ver0;
 
-    /**
-     * @return Future version.
-     */
-    private GridCacheVersion onFutureDone() {
-        GridCacheVersion ver0;
+            GridFutureAdapter<Void> fut0;
+
+            synchronized (this) {
+                fut0 = topCompleteFut;
 
-        GridFutureAdapter<Void> fut0;
+                topCompleteFut = null;
 
-        synchronized (this) {
-            fut0 = topCompleteFut;
+                ver0 = futVer;
 
-            topCompleteFut = null;
+                futVer = null;
+            }
 
-            ver0 = futVer;
+            if (fut0 != null)
+                fut0.onDone();
 
-            futVer = null;
+            return ver0;
         }
 
-        if (fut0 != null)
-            fut0.onDone();
+        /**
+         * @param topNodes Cache nodes.
+         * @param topVer Topology version.
+         * @param futVer Future version.
+         * @param updVer Update version.
+         * @param remapKeys Keys to remap.
+         * @return Mapping.
+         * @throws Exception If failed.
+         */
+        @SuppressWarnings("ConstantConditions")
+        private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+            AffinityTopologyVersion topVer,
+            GridCacheVersion futVer,
+            @Nullable GridCacheVersion updVer,
+            @Nullable Collection<KeyCacheObject> remapKeys) throws Exception {
+            Iterator<?> it = null;
+
+            if (vals != null)
+                it = vals.iterator();
+
+            Iterator<GridCacheDrInfo> conflictPutValsIt = null;
+
+            if (conflictPutVals != null)
+                conflictPutValsIt = conflictPutVals.iterator();
+
+            Iterator<GridCacheVersion> conflictRmvValsIt = null;
+
+            if (conflictRmvVals != null)
+                conflictRmvValsIt = conflictRmvVals.iterator();
+
+            Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+
+            // Create mappings first, then send messages.
+            for (Object key : keys) {
+                if (key == null)
+                    throw new NullPointerException("Null key.");
+
+                Object val;
+                GridCacheVersion conflictVer;
+                long conflictTtl;
+                long conflictExpireTime;
+
+                if (vals != null) {
+                    val = it.next();
+                    conflictVer = null;
+                    conflictTtl = CU.TTL_NOT_CHANGED;
+                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+
+                    if (val == null)
+                        throw new NullPointerException("Null value.");
+                }
+                else if (conflictPutVals != null) {
+                    GridCacheDrInfo conflictPutVal = conflictPutValsIt.next();
 
-        return ver0;
-    }
+                    val = conflictPutVal.valueEx();
+                    conflictVer = conflictPutVal.version();
+                    conflictTtl =  conflictPutVal.ttl();
+                    conflictExpireTime = conflictPutVal.expireTime();
+                }
+                else if (conflictRmvVals != null) {
+                    val = null;
+                    conflictVer = conflictRmvValsIt.next();
+                    conflictTtl = CU.TTL_NOT_CHANGED;
+                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+                }
+                else {
+                    val = null;
+                    conflictVer = null;
+                    conflictTtl = CU.TTL_NOT_CHANGED;
+                    conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+                }
 
-    /**
-     * @param topNodes Cache nodes.
-     * @param topVer Topology version.
-     * @param futVer Future version.
-     * @param updVer Update version.
-     * @param remapKeys Keys to remap.
-     * @return Mapping.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("ConstantConditions")
-    private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
-        AffinityTopologyVersion topVer,
-        GridCacheVersion futVer,
-        @Nullable GridCacheVersion updVer,
-        @Nullable Collection<KeyCacheObject> remapKeys) throws Exception {
-        Iterator<?> it = null;
+                if (val == null && op != GridCacheOperation.DELETE)
+                    continue;
 
-        if (vals != null)
-            it = vals.iterator();
+                KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
 
-        Iterator<GridCacheDrInfo> conflictPutValsIt = null;
+                if (remapKeys != null && !remapKeys.contains(cacheKey))
+                    continue;
 
-        if (conflictPutVals != null)
-            conflictPutValsIt = conflictPutVals.iterator();
+                if (op != TRANSFORM)
+                    val = cctx.toCacheObject(val);
 
-        Iterator<GridCacheVersion> conflictRmvValsIt = null;
+                Collection<ClusterNode> affNodes = mapKey(cacheKey, topVer, fastMap);
 
-        if (conflictRmvVals != null)
-            conflictRmvValsIt = conflictRmvVals.iterator();
+                if (affNodes.isEmpty())
+                    throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
+                        "(all partition nodes left the grid).");
 
-        Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+                int i = 0;
+
+                for (ClusterNode affNode : affNodes) {
+                    if (affNode == null)
+                        throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
+                            "(all partition nodes left the grid).");
+
+                    UUID nodeId = affNode.id();
+
+                    GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
+
+                    if (mapped == null) {
+                        mapped = new GridNearAtomicUpdateRequest(
+                            cctx.cacheId(),
+                            nodeId,
+                            futVer,
+                            fastMap,
+                            updVer,
+                            topVer,
+                            topLocked,
+                            syncMode,
+                            op,
+                            retval,
+                            expiryPlc,
+                            invokeArgs,
+                            filter,
+                            subjId,
+                            taskNameHash,
+                            skipStore,
+                            keepBinary,
+                            cctx.kernalContext().clientNode(),
+                            cctx.deploymentEnabled(),
+                            keys.size());
+
+                        pendingMappings.put(nodeId, mapped);
+                    }
 
-        // Create mappings first, then send messages.
-        for (Object key : keys) {
-            if (key == null)
-                throw new NullPointerException("Null key.");
+                    mapped.addUpdateEntry(cacheKey, val, conflictTtl, conflictExpireTime, conflictVer, i == 0);
+
+                    i++;
+                }
+            }
+
+            return pendingMappings;
+        }
+
+        /**
+         * @param topVer Topology version.
+         * @param futVer Future version.
+         * @param updVer Update version.
+         * @return Request.
+         * @throws Exception If failed.
+         */
+        private GridNearAtomicUpdateRequestInterface mapSingleUpdate(AffinityTopologyVersion topVer,
+            Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer)
+            throws Exception {
+            Object key = F.first(keys);
 
             Object val;
             GridCacheVersion conflictVer;
@@ -839,273 +1139,169 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             long conflictExpireTime;
 
             if (vals != null) {
-                val = it.next();
+                // Regular PUT.
+                val = F.first(vals);
                 conflictVer = null;
                 conflictTtl = CU.TTL_NOT_CHANGED;
                 conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-
-                if (val == null)
-                    throw new NullPointerException("Null value.");
             }
             else if (conflictPutVals != null) {
-                GridCacheDrInfo conflictPutVal = conflictPutValsIt.next();
+                // Conflict PUT.
+                GridCacheDrInfo conflictPutVal = F.first(conflictPutVals);
 
                 val = conflictPutVal.valueEx();
                 conflictVer = conflictPutVal.version();
-                conflictTtl =  conflictPutVal.ttl();
+                conflictTtl = conflictPutVal.ttl();
                 conflictExpireTime = conflictPutVal.expireTime();
             }
             else if (conflictRmvVals != null) {
+                // Conflict REMOVE.
                 val = null;
-                conflictVer = conflictRmvValsIt.next();
+                conflictVer = F.first(conflictRmvVals);
                 conflictTtl = CU.TTL_NOT_CHANGED;
                 conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
             }
             else {
+                // Regular REMOVE.
                 val = null;
                 conflictVer = null;
                 conflictTtl = CU.TTL_NOT_CHANGED;
                 conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
             }
 
+            // We still can get here if user pass map with single element.
+            if (key == null)
+                throw new NullPointerException("Null key.");
+
             if (val == null && op != GridCacheOperation.DELETE)
-                continue;
+                throw new NullPointerException("Null value.");
 
             KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
 
-            if (remapKeys != null && !remapKeys.contains(cacheKey))
-                continue;
-
             if (op != TRANSFORM)
                 val = cctx.toCacheObject(val);
 
-            Collection<ClusterNode> affNodes = mapKey(cacheKey, topVer, fastMap);
+            ClusterNode primary = cctx.affinity().primary(cacheKey, topVer);
 
-            if (affNodes.isEmpty())
-                throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                    "(all partition nodes left the grid).");
+            if (primary == null)
+                throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
+                    "left the grid).");
 
-            int i = 0;
+            // Decide whether we will use optimzied version of update request.
+            boolean optimize = true;
 
-            for (ClusterNode affNode : affNodes) {
-                if (affNode == null)
-                    throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                        "(all partition nodes left the grid).");
+            for (ClusterNode topNode : topNodes) {
+                if (topNode.version().compareTo(SINGLE_PUT_MSG_SINCE) < 0) {
+                    optimize = false;
 
-                UUID nodeId = affNode.id();
-
-                GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
-
-                if (mapped == null) {
-                    mapped = new GridNearAtomicUpdateRequest(
-                        cctx.cacheId(),
-                        nodeId,
-                        futVer,
-                        fastMap,
-                        updVer,
-                        topVer,
-                        topLocked,
-                        syncMode,
-                        op,
-                        retval,
-                        expiryPlc,
-                        invokeArgs,
-                        filter,
-                        subjId,
-                        taskNameHash,
-                        skipStore,
-                        keepBinary,
-                        cctx.kernalContext().clientNode(),
-                        cctx.deploymentEnabled(),
-                        keys.size());
-
-                    pendingMappings.put(nodeId, mapped);
+                    break;
                 }
+            }
 
-                mapped.addUpdateEntry(cacheKey, val, conflictTtl, conflictExpireTime, conflictVer, i == 0);
-
-                i++;
+            if (optimize) {
+                return new GridNearAtomicSingleUpdateRequest(
+                    cacheKey,
+                    val,
+                    conflictTtl,
+                    conflictExpireTime,
+                    conflictVer,
+                    cctx.cacheId(),
+                    primary.id(),
+                    futVer,
+                    fastMap,
+                    updVer,
+                    topVer,
+                    topLocked,
+                    syncMode,
+                    op,
+                    retval,
+                    expiryPlc,
+                    invokeArgs,
+                    filter,
+                    subjId,
+                    taskNameHash,
+                    skipStore,
+                    keepBinary,
+                    cctx.kernalContext().clientNode(),
+                    cctx.deploymentEnabled());
+            }
+            else {
+                GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+                    cctx.cacheId(),
+                    primary.id(),
+                    futVer,
+                    fastMap,
+                    updVer,
+                    topVer,
+                    topLocked,
+                    syncMode,
+                    op,
+                    retval,
+                    expiryPlc,
+                    invokeArgs,
+                    filter,
+                    subjId,
+                    taskNameHash,
+                    skipStore,
+                    keepBinary,
+                    cctx.kernalContext().clientNode(),
+                    cctx.deploymentEnabled(),
+                    1);
+
+                req.addUpdateEntry(cacheKey,
+                    val,
+                    conflictTtl,
+                    conflictExpireTime,
+                    conflictVer,
+                    true);
+
+                return req;
             }
         }
 
-        return pendingMappings;
-    }
-
-    /**
-     * @param topVer Topology version.
-     * @param topNodes Topology nodes.
-     * @param futVer Future version.
-     * @param updVer Update version.
-     * @return Request.
-     * @throws Exception If failed.
-     */
-    private GridNearAtomicUpdateRequestInterface mapSingleUpdate(AffinityTopologyVersion topVer,
-        Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer) throws Exception {
-        Object key = F.first(keys);
-
-        Object val;
-        GridCacheVersion conflictVer;
-        long conflictTtl;
-        long conflictExpireTime;
-
-        if (vals != null) {
-            // Regular PUT.
-            val = F.first(vals);
-            conflictVer = null;
-            conflictTtl = CU.TTL_NOT_CHANGED;
-            conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-        }
-        else if (conflictPutVals != null) {
-            // Conflict PUT.
-            GridCacheDrInfo conflictPutVal = F.first(conflictPutVals);
-
-            val = conflictPutVal.valueEx();
-            conflictVer = conflictPutVal.version();
-            conflictTtl = conflictPutVal.ttl();
-            conflictExpireTime = conflictPutVal.expireTime();
-        }
-        else if (conflictRmvVals != null) {
-            // Conflict REMOVE.
-            val = null;
-            conflictVer = F.first(conflictRmvVals);
-            conflictTtl = CU.TTL_NOT_CHANGED;
-            conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
-        }
-        else {
-            // Regular REMOVE.
-            val = null;
-            conflictVer = null;
-            conflictTtl = CU.TTL_NOT_CHANGED;
-            conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+        /**
+         * @param ret Result from single node.
+         */
+        @SuppressWarnings("unchecked")
+        private void addInvokeResults(GridCacheReturn ret) {
+            assert op == TRANSFORM : op;
+            assert ret.value() == null || ret.value() instanceof Map : ret.value();
+
+            if (ret.value() != null) {
+                if (opRes != null)
+                    opRes.mergeEntryProcessResults(ret);
+                else
+                    opRes = ret;
+            }
         }
 
-        // We still can get here if user pass map with single element.
-        if (key == null)
-            throw new NullPointerException("Null key.");
+        /**
+         * @param failedKeys Failed keys.
+         * @param topVer Topology version for failed update.
+         * @param err Error cause.
+         */
+        private void addFailedKeys(Collection<KeyCacheObject> failedKeys,
+            AffinityTopologyVersion topVer,
+            Throwable err) {
+            CachePartialUpdateCheckedException err0 = this.err;
 
-        if (val == null && op != GridCacheOperation.DELETE)
-            throw new NullPointerException("Null value.");
+            if (err0 == null)
+                err0 = this.err = new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
 
-        KeyCacheObject cacheKey = cctx.toCacheKeyObject(key);
+            Collection<Object> keys = new ArrayList<>(failedKeys.size());
 
-        if (op != TRANSFORM)
-            val = cctx.toCacheObject(val);
+            for (KeyCacheObject key : failedKeys)
+                keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
 
-        ClusterNode primary = cctx.affinity().primary(cacheKey, topVer);
-
-        if (primary == null)
-            throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
-                "left the grid).");
-
-        // Decide whether we will use optimzied version of update request.
-        boolean optimize = true;
-
-        for (ClusterNode topNode : topNodes) {
-            if (topNode.version().compareTo(SINGLE_PUT_MSG_SINCE) < 0) {
-                optimize = false;
-
-                break;
-            }
+            err0.add(keys, err, topVer);
         }
 
-        if (optimize) {
-            return new GridNearAtomicSingleUpdateRequest(
-                cacheKey,
-                val,
-                conflictTtl,
-                conflictExpireTime,
-                conflictVer,
-                cctx.cacheId(),
-                primary.id(),
-                futVer,
-                fastMap,
-                updVer,
-                topVer,
-                topLocked,
-                syncMode,
-                op,
-                retval,
-                expiryPlc,
-                invokeArgs,
-                filter,
-                subjId,
-                taskNameHash,
-                skipStore,
-                keepBinary,
-                cctx.kernalContext().clientNode(),
-                cctx.deploymentEnabled());
-        }
-        else {
-            GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
-                cctx.cacheId(),
-                primary.id(),
-                futVer,
-                fastMap,
-                updVer,
-                topVer,
-                topLocked,
-                syncMode,
-                op,
-                retval,
-                expiryPlc,
-                invokeArgs,
-                filter,
-                subjId,
-                taskNameHash,
-                skipStore,
-                keepBinary,
-                cctx.kernalContext().clientNode(),
-                cctx.deploymentEnabled(),
-                1);
-
-            req.addUpdateEntry(cacheKey,
-                val,
-                conflictTtl,
-                conflictExpireTime,
-                conflictVer,
-                true);
-
-            return req;
-        }
-    }
-
-    /**
-     * @param ret Result from single node.
-     */
-    @SuppressWarnings("unchecked")
-    private void addInvokeResults(GridCacheReturn ret) {
-        assert op == TRANSFORM : op;
-        assert ret.value() == null || ret.value() instanceof Map : ret.value();
-
-        if (ret.value() != null) {
-            if (opRes != null)
-                opRes.mergeEntryProcessResults(ret);
-            else
-                opRes = ret;
+        /** {@inheritDoc} */
+        @Override public synchronized  String toString() {
+            return S.toString(UpdateState.class, this);
         }
     }
 
-    /**
-     * @param failedKeys Failed keys.
-     * @param topVer Topology version for failed update.
-     * @param err Error cause.
-     */
-    private void addFailedKeys(Collection<KeyCacheObject> failedKeys,
-        AffinityTopologyVersion topVer,
-        Throwable err) {
-        CachePartialUpdateCheckedException err0 = this.err;
-
-        if (err0 == null)
-            err0 = this.err = new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
-
-        Collection<Object> keys = new ArrayList<>(failedKeys.size());
-
-        for (KeyCacheObject key : failedKeys)
-            keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
-
-        err0.add(keys, err, topVer);
-    }
-
     /** {@inheritDoc} */
     public String toString() {
         return S.toString(GridNearAtomicUpdateFuture.class, this, super.toString());


[33/51] [abbrv] ignite git commit: Merge branches 'ignite-2523' and 'master' of https://github.com/ilantukh/ignite into ignite-2523

Posted by vo...@apache.org.
Merge branches 'ignite-2523' and 'master' of https://github.com/ilantukh/ignite into ignite-2523


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

Branch: refs/heads/ignite-2523
Commit: 072ba10056d687833579e4816fe7e17f9248bfe7
Parents: 90fce7b 582fe56
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Feb 20 14:53:15 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Feb 20 14:53:15 2016 +0300

----------------------------------------------------------------------
 .gitignore                                      |   1 +
 .../internal/binary/BinaryEnumObjectImpl.java   |   9 +
 .../processors/cache/GridCacheMapEntry.java     |  15 +-
 .../processors/cache/GridCacheMvccManager.java  |   2 +-
 .../processors/cache/dr/GridCacheDrManager.java |   4 +-
 .../cache/dr/GridOsCacheDrManager.java          |   3 +-
 .../datastructures/PlatformAtomicReference.java |   7 +-
 .../query/h2/opt/GridH2ValueCacheObject.java    |   9 +
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 161 ++++++++++++++++
 .../cache/IgniteCacheAbstractQuerySelfTest.java | 187 ++++++++++++++++++-
 .../Apache.Ignite.Core.Tests.NuGet.csproj       | 103 ++++++++++
 .../Apache.Ignite.Core.Tests.NuGet.sln          |  26 +++
 ...ache.Ignite.Core.Tests.NuGet.sln.DotSettings |   4 +
 .../Apache.Ignite.Core.Tests.NuGet/CacheTest.cs | 107 +++++++++++
 .../ComputeTest.cs                              |  84 +++++++++
 .../Config/ignite-config.xml                    |  50 +++++
 .../Apache.Ignite.Core.Tests.NuGet/NuGet.config |  34 ++++
 .../Properties/AssemblyInfo.cs                  |  35 ++++
 .../StartupTest.cs                              |  66 +++++++
 .../TestRunner.cs                               |  70 +++++++
 .../Apache.Ignite.Core.Tests.NuGet/TestUtil.cs  |  43 +++++
 .../install-package.cmd                         |   3 +
 .../IgniteStartStopTest.cs                      |  58 ++----
 .../Apache.Ignite.Core.csproj                   |   4 +
 .../Apache.Ignite.Core.nuspec                   |  80 ++++++++
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |  56 ++++--
 .../Impl/Common/IgniteHome.cs                   |  11 +-
 .../Impl/DataStructures/AtomicReference.cs      |   2 +-
 .../dotnet/Apache.Ignite.Core/NuGet/Install.ps1 |  27 +++
 .../NuGet/LINQPad/ComputeExample.linq           | 106 +++++++++++
 .../NuGet/LINQPad/PutGetExample.linq            |  69 +++++++
 .../NuGet/LINQPad/QueryExample.linq             |  96 ++++++++++
 .../Apache.Ignite.Core/NuGet/PostBuild.ps1      |  20 ++
 .../Apache.Ignite.Core/NuGet/Uninstall.ps1      |  21 +++
 .../apache/ignite/yarn/ApplicationMaster.java   |  30 ++-
 .../apache/ignite/yarn/IgniteYarnClient.java    |  25 +++
 .../ignite/yarn/utils/IgniteYarnUtils.java      |  19 ++
 parent/pom.xml                                  |   2 +
 38 files changed, 1568 insertions(+), 81 deletions(-)
----------------------------------------------------------------------



[21/51] [abbrv] ignite git commit: ignite-2523 : SingleUpdateResponse implementation.

Posted by vo...@apache.org.
ignite-2523 : SingleUpdateResponse implementation.


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

Branch: refs/heads/ignite-2523
Commit: c39410a2dbbab7e8886a407a5661b29ee985adce
Parents: dfdd2f4
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Mon Feb 8 18:05:34 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Mon Feb 8 18:05:34 2016 +0300

----------------------------------------------------------------------
 .../GridNearAtomicSingleUpdateResponse.java     | 195 ++++++++-----------
 1 file changed, 84 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c39410a2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index 581c33b..0bea0dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
@@ -38,11 +39,10 @@ import org.jetbrains.annotations.Nullable;
 
 import java.io.Externalizable;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
 
 public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
 
@@ -70,28 +70,21 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
     @GridToStringInclude
     private GridCacheReturn ret;
 
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private volatile Collection<KeyCacheObject> failedKeys;
+    private KeyCacheObject key;
 
-    /** Keys that should be remapped. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> remapKeys;
+    private boolean failed;
 
-    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearValsIdxs;
+    private boolean remap;
 
-    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearSkipIdxs;
+    private boolean hasNearVal;
 
-    /** Values generated on primary node which should be put to originating node's near cache. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
+    private CacheObject nearVal;
+
+    private boolean nearSkip;
+
+    private long nearTtl = -1;
+
+    private long nearExpireTime = -1;
 
     /** Version generated on primary node to be used for originating node's near cache update. */
     private GridCacheVersion nearVer;
@@ -168,7 +161,10 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @return Collection of failed keys.
      */
     @Override public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
+        if (failed && key != null)
+            return Collections.singletonList(key);
+
+        return Collections.emptyList();
     }
 
     /**
@@ -190,14 +186,23 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @param remapKeys Remap keys.
      */
     @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
-        this.remapKeys = remapKeys;
+        assert remapKeys.size() <= 1;
+
+        if (remapKeys.isEmpty())
+            return;
+
+        key = remapKeys.get(0);
+        remap = true;
     }
 
     /**
      * @return Remap keys.
      */
     @Override public Collection<KeyCacheObject> remapKeys() {
-        return remapKeys;
+        if (remap && key != null)
+            return Collections.singletonList(key);
+
+        return Collections.emptyList();
     }
 
     /**
@@ -212,15 +217,13 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
         @Nullable CacheObject val,
         long ttl,
         long expireTime) {
-        if (nearValsIdxs == null) {
-            nearValsIdxs = new ArrayList<>();
-            nearVals = new ArrayList<>();
-        }
 
-        addNearTtl(keyIdx, ttl, expireTime);
+        assert keyIdx == 0;
 
-        nearValsIdxs.add(keyIdx);
-        nearVals.add(val);
+        nearVal = val;
+        hasNearVal = true;
+
+        addNearTtl(keyIdx, ttl, expireTime);
     }
 
     /**
@@ -230,29 +233,11 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      */
     @Override @SuppressWarnings("ForLoopReplaceableByForEach")
     public void addNearTtl(int keyIdx, long ttl, long expireTime) {
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(16);
+        assert keyIdx == 0;
 
-                for (int i = 0; i < keyIdx; i++)
-                    nearTtls.add(-1L);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
+        nearTtl = ttl >= 0 ? ttl : -1;
 
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearExpireTimes.add(-1);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
+        nearExpireTime = expireTime >= 0 ? expireTime : -1;
     }
 
     /**
@@ -260,11 +245,8 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @return Expire time for near cache update.
      */
     @Override public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
+        if (idx == 0)
+            return nearExpireTime;
 
         return -1L;
     }
@@ -274,11 +256,8 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @return TTL for near cache update.
      */
     @Override public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
+        if (idx == 0)
+            return nearTtl;
 
         return -1L;
     }
@@ -301,26 +280,31 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @param keyIdx Index of key for which update was skipped
      */
     @Override public void addSkippedIndex(int keyIdx) {
-        if (nearSkipIdxs == null)
-            nearSkipIdxs = new ArrayList<>();
+        assert keyIdx == 0;
 
-        nearSkipIdxs.add(keyIdx);
-
-        addNearTtl(keyIdx, -1L, -1L);
+        nearSkip = true;
+        nearTtl = -1;
+        nearExpireTime = -1;
     }
 
     /**
      * @return Indexes of keys for which update was skipped
      */
     @Override @Nullable public List<Integer> skippedIndexes() {
-        return nearSkipIdxs;
+        if (nearSkip && key != null)
+            return Collections.singletonList(0);
+
+        return Collections.emptyList();
     }
 
     /**
      * @return Indexes of keys for which values were generated on primary node.
      */
     @Override @Nullable public List<Integer> nearValuesIndexes() {
-        return nearValsIdxs;
+        if (hasNearVal && key != null)
+            return Collections.singletonList(0);
+
+        return Collections.emptyList();
     }
 
     /**
@@ -328,7 +312,12 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @return Value generated on primary node which should be put to originating node's near cache.
      */
     @Override @Nullable public CacheObject nearValue(int idx) {
-        return nearVals.get(idx);
+        assert idx == 0;
+
+        if (hasNearVal)
+            return nearVal;
+
+        return null;
     }
 
     /**
@@ -338,13 +327,10 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      * @param e Error cause.
      */
     @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ConcurrentLinkedQueue<>();
-
-        failedKeys.add(key);
+        this.key = key;
+        failed = true;
 
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
+        err = new IgniteCheckedException("Failed to update keys on primary node.");
 
         err.addSuppressed(e);
     }
@@ -357,14 +343,13 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      */
     @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
         if (keys != null) {
-            if (failedKeys == null)
-                failedKeys = new ArrayList<>(keys.size());
+            assert keys.size() <= 1;
 
-            failedKeys.addAll(keys);
+            if (keys.size() == 1)
+                key = F.first(keys);
         }
 
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
+        err = new IgniteCheckedException("Failed to update keys on primary node.");
 
         err.addSuppressed(e);
     }
@@ -378,15 +363,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
      */
     @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
         GridCacheContext ctx) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>(keys.size());
-
-        failedKeys.addAll(keys);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
+        addFailedKeys(keys, e);
     }
 
     /** {@inheritDoc}
@@ -399,11 +376,9 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 
-        prepareMarshalCacheObjects(failedKeys, cctx);
+        prepareMarshalCacheObject(key, cctx);
 
-        prepareMarshalCacheObjects(remapKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
+        prepareMarshalCacheObject(nearVal, cctx);
 
         if (ret != null)
             ret.prepareMarshal(cctx);
@@ -418,11 +393,9 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
+        finishUnmarshalCacheObject(key, cctx, ldr);
 
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+        finishUnmarshalCacheObject(nearVal, cctx, ldr);
 
         if (ret != null)
             ret.finishUnmarshal(cctx, ldr);
@@ -455,7 +428,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                if (!writer.writeBoolean("failed", failed))
                     return false;
 
                 writer.incrementState();
@@ -467,31 +440,31 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                if (!writer.writeLong("nearExpireTime", nearExpireTime))
                     return false;
 
                 writer.incrementState();
 
             case 7:
-                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
+                if (!writer.writeBoolean("nearSkip", nearSkip))
                     return false;
 
                 writer.incrementState();
 
             case 8:
-                if (!writer.writeMessage("nearTtls", nearTtls))
+                if (!writer.writeLong("nearTtl", nearTtl))
                     return false;
 
                 writer.incrementState();
 
             case 9:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                if (!writer.writeMessage("nearVal", nearVal))
                     return false;
 
                 writer.incrementState();
 
             case 10:
-                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
+                if (!writer.writeBoolean("hasNearVal", hasNearVal))
                     return false;
 
                 writer.incrementState();
@@ -503,7 +476,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 writer.incrementState();
 
             case 12:
-                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
+                if (!writer.writeMessage("key", key))
                     return false;
 
                 writer.incrementState();
@@ -539,7 +512,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+                failed = reader.readBoolean("failed");
 
                 if (!reader.isLastRead())
                     return false;
@@ -555,7 +528,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 6:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
+                nearExpireTime = reader.readLong("nearExpireTime");
 
                 if (!reader.isLastRead())
                     return false;
@@ -563,7 +536,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 7:
-                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
+                nearSkip = reader.readBoolean("nearSkip");
 
                 if (!reader.isLastRead())
                     return false;
@@ -571,7 +544,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 8:
-                nearTtls = reader.readMessage("nearTtls");
+                nearTtl = reader.readLong("nearTtl");
 
                 if (!reader.isLastRead())
                     return false;
@@ -579,7 +552,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 9:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+                nearVal = reader.readMessage("nearVal");
 
                 if (!reader.isLastRead())
                     return false;
@@ -587,7 +560,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 10:
-                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
+                hasNearVal = reader.readBoolean("hasNearVal");
 
                 if (!reader.isLastRead())
                     return false;
@@ -603,7 +576,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
                 reader.incrementState();
 
             case 12:
-                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
+                key = reader.readMessage("key");
 
                 if (!reader.isLastRead())
                     return false;


[49/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java
deleted file mode 100644
index f521f7d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheReturn;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Base interface for near atomic update responses.
- */
-public interface GridNearAtomicUpdateResponseInterface extends Message {
-
-    /**
-     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
-     *
-     * @return Message lookup index.
-     */
-    int lookupIndex();
-
-    /**
-     * @return Mapped node ID.
-     */
-    UUID nodeId();
-
-    /**
-     * @param nodeId Node ID.
-     */
-    void nodeId(UUID nodeId);
-
-    /**
-     * @return Future version.
-     */
-    GridCacheVersion futureVersion();
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    void error(IgniteCheckedException err);
-
-    /**
-     * @return Error, if any.
-     */
-    IgniteCheckedException error();
-
-    /**
-     * @return Collection of failed keys.
-     */
-    Collection<KeyCacheObject> failedKeys();
-
-    /**
-     * @return Return value.
-     */
-    GridCacheReturn returnValue();
-
-    /**
-     * @param ret Return value.
-     */
-    @SuppressWarnings("unchecked") void returnValue(GridCacheReturn ret);
-
-    /**
-     * @param remapKeys Remap keys.
-     */
-    void remapKeys(List<KeyCacheObject> remapKeys);
-
-    /**
-     * @return Remap keys.
-     */
-    Collection<KeyCacheObject> remapKeys();
-
-    /**
-     * Adds value to be put in near cache on originating node.
-     *
-     * @param keyIdx Key index.
-     * @param val Value.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    void addNearValue(int keyIdx,
-        @Nullable CacheObject val,
-        long ttl,
-        long expireTime);
-
-    /**
-     * @param keyIdx Key index.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    @SuppressWarnings("ForLoopReplaceableByForEach") void addNearTtl(int keyIdx, long ttl, long expireTime);
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    long nearExpireTime(int idx);
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    long nearTtl(int idx);
-
-    /**
-     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
-     */
-    void nearVersion(GridCacheVersion nearVer);
-
-    /**
-     * @return Version generated on primary node to be used for originating node's near cache update.
-     */
-    GridCacheVersion nearVersion();
-
-    /**
-     * @param keyIdx Index of key for which update was skipped
-     */
-    void addSkippedIndex(int keyIdx);
-
-    /**
-     * @return Indexes of keys for which update was skipped
-     */
-    @Nullable List<Integer> skippedIndexes();
-
-    /**
-     * @return Indexes of keys for which values were generated on primary node.
-     */
-    @Nullable List<Integer> nearValuesIndexes();
-
-    /**
-     * @param idx Index.
-     * @return Value generated on primary node which should be put to originating node's near cache.
-     */
-    @Nullable CacheObject nearValue(int idx);
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    void addFailedKey(KeyCacheObject key, Throwable e);
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     */
-    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e);
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     * @param ctx Context.
-     */
-    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx);
-
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
-
-    /**
-     * This method is called after the message is deserialized and is responsible for
-     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
-
-    /**
-     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
-     *
-     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
-     */
-    boolean addDeploymentInfo();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index efe8347..4f133e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -33,10 +33,10 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequestInterface;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponseInterface;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponseInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -125,8 +125,8 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      * @param res Update response.
      */
     public void processNearAtomicUpdateResponse(
-        GridNearAtomicUpdateRequestInterface req,
-        GridNearAtomicUpdateResponseInterface res
+        GridNearAtomicUpdateRequest req,
+        GridNearAtomicUpdateResponse res
     ) {
         if (F.size(res.failedKeys()) == req.keys().size())
             return;
@@ -300,8 +300,8 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      */
     public void processDhtAtomicUpdateRequest(
         UUID nodeId,
-        GridDhtAtomicUpdateRequestInterface req,
-        GridDhtAtomicUpdateResponseInterface res
+        GridDhtAtomicUpdateRequest req,
+        GridDhtAtomicUpdateResponse res
     ) {
         GridCacheVersion ver = req.writeVersion();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index 4c011db..5509496 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponseInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.testframework.GridTestUtils;
 
@@ -458,7 +458,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicUpdateResponseInterface.class);
+            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a042449/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 4733e19..49686fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -63,7 +63,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -412,7 +412,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         assertEquals(3, msgs.size());
 
         for (Object msg : msgs)
-            assertTrue(((GridNearAtomicUpdateRequestInterface)msg).clientRequest());
+            assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());
 
         map.put(primaryKey(ignite0.cache(null)), 3);
         map.put(primaryKey(ignite1.cache(null)), 4);


[24/51] [abbrv] ignite git commit: ignite-2523 : finished generalization of GridNearAtomicUpdate.

Posted by vo...@apache.org.
ignite-2523 : finished generalization of GridNearAtomicUpdate.


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

Branch: refs/heads/ignite-2523
Commit: 4f8220e6da06443f1ef42ac3f4b4e46f5100dcd1
Parents: cb5bdb3
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Feb 9 14:38:12 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Tue Feb 9 14:38:12 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 29 +++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4f8220e6/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 682935f..55442dc 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
@@ -71,7 +71,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
 /**
  * DHT atomic cache near update future.
  */
-public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implements GridCacheAtomicFuture<Object>{
+public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implements GridCacheAtomicFuture<Object> {
     /** Version where single-put optimization appeared.*/
     public static final IgniteProductVersion SINGLE_PUT_MSG_SINCE = IgniteProductVersion.fromString("1.6.0");
 
@@ -511,7 +511,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
                 new CI2<GridNearAtomicMultipleUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicMultipleUpdateRequest req, GridNearAtomicMultipleUpdateResponse res) {
+                    @Override public void apply(GridNearAtomicMultipleUpdateRequest req,
+                        GridNearAtomicMultipleUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -610,8 +611,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param res Response.
          * @param nodeErr {@code True} if response was created on node failure.
          */
-        @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
-        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
+        @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"}) void onResult(UUID nodeId,
+            GridNearAtomicUpdateResponse res, boolean nodeErr) {
             GridNearAtomicUpdateRequest req;
 
             AffinityTopologyVersion remapTopVer = null;
@@ -818,10 +819,18 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          */
         void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
             synchronized (this) {
-                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
-                    req.nodeId(),
-                    req.futureVersion(),
-                    cctx.deploymentEnabled());
+                GridNearAtomicUpdateResponse res;
+
+                if (req instanceof GridNearAtomicSingleUpdateRequest)
+                    res = new GridNearAtomicSingleUpdateResponse(cctx.cacheId(),
+                        req.nodeId(),
+                        req.futureVersion(),
+                        cctx.deploymentEnabled());
+                else
+                    res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
+                        req.nodeId(),
+                        req.futureVersion(),
+                        cctx.deploymentEnabled());
 
                 res.addFailedKeys(req.keys(), e);
 
@@ -1043,7 +1052,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
                     val = conflictPutVal.valueEx();
                     conflictVer = conflictPutVal.version();
-                    conflictTtl =  conflictPutVal.ttl();
+                    conflictTtl = conflictPutVal.ttl();
                     conflictExpireTime = conflictPutVal.expireTime();
                 }
                 else if (conflictRmvVals != null) {
@@ -1298,7 +1307,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         }
 
         /** {@inheritDoc} */
-        @Override public synchronized  String toString() {
+        @Override public synchronized String toString() {
             return S.toString(UpdateState.class, this);
         }
     }


[28/51] [abbrv] ignite git commit: ignite-2523 : Created GridDhtAtomicSingleUpdateRequest optimized implementation.

Posted by vo...@apache.org.
ignite-2523 : Created GridDhtAtomicSingleUpdateRequest optimized implementation.


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

Branch: refs/heads/ignite-2523
Commit: 3391c847e9825405d8ca2f7df7e01ba432f60b1b
Parents: 6040f45
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Feb 9 17:43:39 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Tue Feb 9 17:43:39 2016 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |   20 +-
 .../processors/cache/GridCacheIoManager.java    |   22 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   32 +-
 .../GridDhtAtomicMultipleUpdateRequest.java     | 1065 ++++++++++++++++++
 .../GridDhtAtomicMultipleUpdateResponse.java    |  297 +++++
 .../GridDhtAtomicSingleUpdateRequest.java       | 1035 +++++++++++++++++
 .../GridDhtAtomicSingleUpdateResponse.java      |  296 +++++
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |   88 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 1056 +----------------
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  300 +----
 .../GridNearAtomicSingleUpdateResponse.java     |    2 +-
 .../distributed/near/GridNearAtomicCache.java   |    2 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |    6 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    2 +-
 14 files changed, 2911 insertions(+), 1312 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 4d769af..2366104 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -66,8 +66,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrep
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
@@ -354,12 +356,12 @@ public class GridIoMessageFactory implements MessageFactory {
                 break;
 
             case 38:
-                msg = new GridDhtAtomicUpdateRequest();
+                msg = new GridDhtAtomicMultipleUpdateRequest();
 
                 break;
 
             case 39:
-                msg = new GridDhtAtomicUpdateResponse();
+                msg = new GridDhtAtomicMultipleUpdateResponse();
 
                 break;
 
@@ -738,6 +740,16 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
+            case -25:
+                msg = new GridDhtAtomicSingleUpdateRequest();
+
+                break;
+
+            case -26:
+                msg = new GridDhtAtomicSingleUpdateResponse();
+
+                break;
+
             // [-3..119] [124] - this
             // [120..123] - DR
             // [-4..-22] - SQL

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 7ba9542..a4ad500 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -42,6 +42,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRe
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
@@ -398,14 +402,22 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             case 38: {
                 GridDhtAtomicUpdateRequest req = (GridDhtAtomicUpdateRequest)msg;
 
-                GridDhtAtomicUpdateResponse res = new GridDhtAtomicUpdateResponse(
-                    ctx.cacheId(),
-                    req.futureVersion(),
-                    ctx.deploymentEnabled());
+                GridDhtAtomicUpdateResponse res;
+
+                if (req instanceof GridDhtAtomicSingleUpdateRequest)
+                    res = new GridDhtAtomicSingleUpdateResponse(
+                        ctx.cacheId(),
+                        req.futureVersion(),
+                        ctx.deploymentEnabled());
+                else
+                    res = new GridDhtAtomicMultipleUpdateResponse(
+                        ctx.cacheId(),
+                        req.futureVersion(),
+                        ctx.deploymentEnabled());
 
                 res.onError(req.classError());
 
-                sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+                sendResponseOnFailedMessage(nodeId, (GridCacheMessage) res, cctx, ctx.ioPolicy());
             }
 
             break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 629aa25..454a3aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -275,14 +275,26 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateRequest.class, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
-            @Override public void apply(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateRequest.class, new CI2<UUID, GridDhtAtomicMultipleUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateRequest req) {
                 processDhtAtomicUpdateRequest(nodeId, req);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateResponse.class, new CI2<UUID, GridDhtAtomicUpdateResponse>() {
-            @Override public void apply(UUID nodeId, GridDhtAtomicUpdateResponse res) {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicSingleUpdateRequest.class, new CI2<UUID, GridDhtAtomicSingleUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicSingleUpdateRequest req) {
+                processDhtAtomicUpdateRequest(nodeId, req);
+            }
+        });
+
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateResponse.class, new CI2<UUID, GridDhtAtomicMultipleUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateResponse res) {
+                processDhtAtomicUpdateResponse(nodeId, res);
+            }
+        });
+
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicSingleUpdateResponse.class, new CI2<UUID, GridDhtAtomicSingleUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicSingleUpdateResponse res) {
                 processDhtAtomicUpdateResponse(nodeId, res);
             }
         });
@@ -2774,8 +2786,14 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         GridCacheVersion ver = req.writeVersion();
 
         // Always send update reply.
-        GridDhtAtomicUpdateResponse res = new GridDhtAtomicUpdateResponse(ctx.cacheId(), req.futureVersion(),
-            ctx.deploymentEnabled());
+        GridDhtAtomicUpdateResponse res;
+
+        if (req instanceof GridDhtAtomicSingleUpdateRequest)
+            res = new GridDhtAtomicSingleUpdateResponse(ctx.cacheId(), req.futureVersion(),
+                ctx.deploymentEnabled());
+        else
+            res = new GridDhtAtomicMultipleUpdateResponse(ctx.cacheId(), req.futureVersion(),
+                ctx.deploymentEnabled());
 
         Boolean replicate = ctx.isDrEnabled();
 
@@ -2871,7 +2889,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
         try {
             if (res.failedKeys() != null || res.nearEvicted() != null || req.writeSynchronizationMode() == FULL_SYNC)
-                ctx.io().send(nodeId, res, ctx.ioPolicy());
+                ctx.io().send(nodeId, (GridCacheMessage) res, ctx.ioPolicy());
             else {
                 // No failed keys and sync mode is not FULL_SYNC, thus sending deferred response.
                 sendDeferredUpdateResponse(nodeId, req.futureVersion());

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
new file mode 100644
index 0000000..40d68fa
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
@@ -0,0 +1,1065 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Lite dht cache backup update request.
+ */
+public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Write version. */
+    private GridCacheVersion writeVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Previous values. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> prevVals;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** TTLs. */
+    private GridLongList ttls;
+
+    /** Conflict expire time. */
+    private GridLongList conflictExpireTimes;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Near cache keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearKeys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Force transform backups flag. */
+    private boolean forceTransformBackups;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Near entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
+
+    /** Near entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> nearEntryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Partition. */
+    private GridLongList updateCntrs;
+
+    /** On response flag. Access should be synced on future. */
+    @GridDirectTransient
+    private boolean onRes;
+
+    /** */
+    @GridDirectTransient
+    private List<Integer> partIds;
+
+    /** */
+    @GridDirectTransient
+    private List<CacheObject> locPrevVals;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicMultipleUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param writeVer Write version for cache values.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param syncMode Cache write synchronization mode.
+     * @param topVer Topology version.
+     * @param forceTransformBackups Force transform backups flag.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicMultipleUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        GridCacheVersion writeVer,
+        CacheWriteSynchronizationMode syncMode,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean forceTransformBackups,
+        UUID subjId,
+        int taskNameHash,
+        Object[] invokeArgs,
+        boolean addDepInfo,
+        boolean keepBinary
+    ) {
+        assert invokeArgs == null || forceTransformBackups;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.writeVer = writeVer;
+        this.syncMode = syncMode;
+        this.topVer = topVer;
+        this.forceTransformBackups = forceTransformBackups;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.invokeArgs = invokeArgs;
+        this.addDepInfo = addDepInfo;
+        this.keepBinary = keepBinary;
+
+        keys = new ArrayList<>();
+        partIds = new ArrayList<>();
+        locPrevVals = new ArrayList<>();
+
+        if (forceTransformBackups) {
+            entryProcessors = new ArrayList<>();
+            entryProcessorsBytes = new ArrayList<>();
+        }
+        else
+            vals = new ArrayList<>();
+    }
+
+    /**
+     * @return Force transform backups flag.
+     */
+    @Override public boolean forceTransformBackups() {
+        return forceTransformBackups;
+    }
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
+     * @param addPrevVal If {@code true} adds previous value.
+     * @param prevVal Previous value.
+     */
+    @Override public void addWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean addPrevVal,
+        int partId,
+        @Nullable CacheObject prevVal,
+        @Nullable Long updateIdx) {
+        keys.add(key);
+
+        partIds.add(partId);
+
+        locPrevVals.add(prevVal);
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            entryProcessors.add(entryProcessor);
+        }
+        else
+            vals.add(val);
+
+        if (addPrevVal) {
+            if (prevVals == null)
+                prevVals = new ArrayList<>();
+
+            prevVals.add(prevVal);
+        }
+
+        if (updateIdx != null) {
+            if (updateCntrs == null)
+                updateCntrs = new GridLongList();
+
+            updateCntrs.add(updateIdx);
+        }
+
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>();
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictVers.add(null);
+            }
+
+            conflictVers.add(conflictVer);
+        }
+        else if (conflictVers != null)
+            conflictVers.add(null);
+
+        if (ttl >= 0) {
+            if (ttls == null) {
+                ttls = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    ttls.add(CU.TTL_NOT_CHANGED);
+            }
+        }
+
+        if (ttls != null)
+            ttls.add(ttl);
+
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+        }
+
+        if (conflictExpireTimes != null)
+            conflictExpireTimes.add(conflictExpireTime);
+    }
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL.
+     * @param expireTime Expire time.
+     */
+    @Override public void addNearWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long expireTime) {
+        if (nearKeys == null) {
+            nearKeys = new ArrayList<>();
+
+            if (forceTransformBackups) {
+                nearEntryProcessors = new ArrayList<>();
+                nearEntryProcessorsBytes = new ArrayList<>();
+            }
+            else
+                nearVals = new ArrayList<>();
+        }
+
+        nearKeys.add(key);
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            nearEntryProcessors.add(entryProcessor);
+        }
+        else
+            nearVals.add(val);
+
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(nearKeys.size());
+
+                for (int i = 0; i < nearKeys.size() - 1; i++)
+                    nearTtls.add(CU.TTL_NOT_CHANGED);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(nearKeys.size());
+
+                for (int i = 0; i < nearKeys.size() - 1; i++)
+                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Node ID.
+     */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @return Subject ID.
+     */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /**
+     * @return Task name.
+     */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /**
+     * @return Keys size.
+     */
+    @Override public int size() {
+        return keys.size();
+    }
+
+    /**
+     * @return Keys size.
+     */
+    @Override public int nearSize() {
+        return nearKeys != null ? nearKeys.size() : 0;
+    }
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * @return Write version.
+     */
+    @Override public GridCacheVersion writeVersion() {
+        return writeVer;
+    }
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /**
+     * @return Topology version.
+     */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /**
+     * @return Keys.
+     */
+    @Override public Collection<KeyCacheObject> keys() {
+        return keys;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Key.
+     */
+    @Override public KeyCacheObject key(int idx) {
+        return keys.get(idx);
+    }
+
+    /**
+     * @param idx Partition index.
+     * @return Partition id.
+     */
+    @Override public int partitionId(int idx) {
+        return partIds.get(idx);
+    }
+
+    /**
+     * @param updCntr Update counter.
+     * @return Update counter.
+     */
+    @Override public Long updateCounter(int updCntr) {
+        if (updateCntrs != null && updCntr < updateCntrs.size())
+            return updateCntrs.get(updCntr);
+
+        return null;
+    }
+
+    /**
+     * @param idx Near key index.
+     * @return Key.
+     */
+    @Override public KeyCacheObject nearKey(int idx) {
+        return nearKeys.get(idx);
+    }
+
+    /**
+     * @return Keep binary flag.
+     */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject value(int idx) {
+        if (vals != null)
+            return vals.get(idx);
+
+        return null;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject previousValue(int idx) {
+        if (prevVals != null)
+            return prevVals.get(idx);
+
+        return null;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject localPreviousValue(int idx) {
+        return locPrevVals.get(idx);
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        return entryProcessors == null ? null : entryProcessors.get(idx);
+    }
+
+    /**
+     * @param idx Near key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        if (nearVals != null)
+            return nearVals.get(idx);
+
+        return null;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Transform closure.
+     */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
+        return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
+    }
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
+
+            return conflictVers.get(idx);
+        }
+
+        return null;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL.
+     */
+    @Override public long ttl(int idx) {
+        if (ttls != null) {
+            assert idx >= 0 && idx < ttls.size();
+
+            return ttls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    @Override public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
+
+            return conflictExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /**
+     * @return {@code True} if on response flag changed.
+     */
+    @Override public boolean onResponse() {
+        return !onRes && (onRes = true);
+    }
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(keys, cctx);
+
+        prepareMarshalCacheObjects(vals, cctx);
+
+        prepareMarshalCacheObjects(nearKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        prepareMarshalCacheObjects(prevVals, cctx);
+
+        if (forceTransformBackups) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+
+            if (entryProcessorsBytes == null)
+                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+            if (nearEntryProcessorsBytes == null)
+                nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, cctx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        finishUnmarshalCacheObjects(prevVals, cctx, ldr);
+
+        if (forceTransformBackups) {
+            if (entryProcessors == null)
+                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+
+            if (nearEntryProcessors == null)
+                nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeCollection("nearKeys", nearKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeCollection("prevVals", prevVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeMessage("ttls", ttls))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeMessage("updateCntrs", updateCntrs))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("writeVer", writeVer))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                forceTransformBackups = reader.readBoolean("forceTransformBackups");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                nearKeys = reader.readCollection("nearKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                prevVals = reader.readCollection("prevVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 17:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 19:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 21:
+                ttls = reader.readMessage("ttls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                updateCntrs = reader.readMessage("updateCntrs");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                writeVer = reader.readMessage("writeVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicMultipleUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 38;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 25;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicMultipleUpdateRequest.class, this, "super", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
new file mode 100644
index 0000000..cd0b9a6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
@@ -0,0 +1,297 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ * DHT atomic cache backup update response.
+ */
+public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> failedKeys;
+
+    /** Update error. */
+    @GridDirectTransient
+    private IgniteCheckedException err;
+
+    /** Serialized update error. */
+    private byte[] errBytes;
+
+    /** Evicted readers. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearEvicted;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicMultipleUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicMultipleUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
+        this.cacheId = cacheId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Future version.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    @Override public void onError(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /**
+     * @return Failed keys.
+     */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * @return Evicted readers.
+     */
+    @Override public Collection<KeyCacheObject> nearEvicted() {
+        return nearEvicted;
+    }
+
+    /**
+     * Adds near evicted key..
+     *
+     * @param key Evicted key.
+     */
+    @Override public void addNearEvicted(KeyCacheObject key) {
+        if (nearEvicted == null)
+            nearEvicted = new ArrayList<>();
+
+        nearEvicted.add(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(nearEvicted, cctx);
+
+        if (errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicMultipleUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 39;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 7;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicMultipleUpdateResponse.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
new file mode 100644
index 0000000..c842270
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -0,0 +1,1035 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  * contributor license agreements.  See the NOTICE file distributed with
+ *  * this work for additional information regarding copyright ownership.
+ *  * The ASF licenses this file to You under the Apache License, Version 2.0
+ *  * (the "License"); you may not use this file except in compliance with
+ *  * the License.  You may obtain a copy of the License at
+ *  *
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.
+ *
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import javax.cache.processor.EntryProcessor;
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Write version. */
+    private GridCacheVersion writeVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    @GridToStringInclude
+    private KeyCacheObject key;
+
+    @GridToStringInclude
+    private CacheObject val;
+
+    @GridToStringInclude
+    private CacheObject prevVal;
+
+    @GridToStringInclude
+    private GridCacheVersion conflictVer;
+
+    private long ttl = CU.TTL_NOT_CHANGED;
+
+    private long conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
+
+    private long nearTtl = CU.TTL_NOT_CHANGED;
+
+    private long nearExpireTime = CU.EXPIRE_TIME_CALCULATE;
+
+    @GridToStringInclude
+    private KeyCacheObject nearKey;
+
+    @GridToStringInclude
+    private CacheObject nearVal;
+
+    @GridDirectTransient
+    private EntryProcessor<Object, Object, Object> entryProcessor;
+
+    private byte[] entryProcessorBytes;
+
+    @GridDirectTransient
+    private EntryProcessor<Object, Object, Object> nearEntryProcessor;
+
+    private byte[] nearEntryProcessorBytes;
+
+    private long updateCntr = -1;
+
+    @GridDirectTransient
+    private int partId;
+
+    @GridDirectTransient
+    private CacheObject locPrevVal;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Previous values. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> prevVals;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** TTLs. */
+    private GridLongList ttls;
+
+    /** Conflict expire time. */
+    private GridLongList conflictExpireTimes;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Near cache keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearKeys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Force transform backups flag. */
+    private boolean forceTransformBackups;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Near entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
+
+    /** Near entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> nearEntryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Partition. */
+    private GridLongList updateCntrs;
+
+    /** On response flag. Access should be synced on future. */
+    @GridDirectTransient
+    private boolean onRes;
+
+    /** */
+    @GridDirectTransient
+    private List<Integer> partIds;
+
+    /** */
+    @GridDirectTransient
+    private List<CacheObject> locPrevVals;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicSingleUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param writeVer Write version for cache values.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param syncMode Cache write synchronization mode.
+     * @param topVer Topology version.
+     * @param forceTransformBackups Force transform backups flag.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicSingleUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        GridCacheVersion writeVer,
+        CacheWriteSynchronizationMode syncMode,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean forceTransformBackups,
+        UUID subjId,
+        int taskNameHash,
+        Object[] invokeArgs,
+        boolean addDepInfo,
+        boolean keepBinary
+    ) {
+        assert invokeArgs == null || forceTransformBackups;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.writeVer = writeVer;
+        this.syncMode = syncMode;
+        this.topVer = topVer;
+        this.forceTransformBackups = forceTransformBackups;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.invokeArgs = invokeArgs;
+        this.addDepInfo = addDepInfo;
+        this.keepBinary = keepBinary;
+
+        keys = new ArrayList<>();
+        partIds = new ArrayList<>();
+        locPrevVals = new ArrayList<>();
+
+        if (forceTransformBackups) {
+            entryProcessors = new ArrayList<>();
+            entryProcessorsBytes = new ArrayList<>();
+        }
+        else
+            vals = new ArrayList<>();
+    }
+
+    /**
+     * @return Force transform backups flag.
+     */
+    @Override public boolean forceTransformBackups() {
+        return forceTransformBackups;
+    }
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
+     * @param addPrevVal If {@code true} adds previous value.
+     * @param prevVal Previous value.
+     */
+    @Override public void addWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean addPrevVal,
+        int partId,
+        @Nullable CacheObject prevVal,
+        @Nullable Long updateIdx) {
+        this.key = key;
+
+        this.partId = partId;
+
+        this.locPrevVal = prevVal;
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            this.entryProcessor = entryProcessor;
+        }
+        else
+            this.val = val;
+
+        if (addPrevVal)
+            this.prevVal = prevVal;
+
+        if (updateIdx != null)
+            updateCntr = updateIdx;
+
+        this.conflictVer = conflictVer;
+
+        if (ttl >= 0)
+            this.ttl = ttl;
+
+        if (conflictExpireTime >= 0)
+            this.conflictExpireTime = conflictExpireTime;
+    }
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL.
+     * @param expireTime Expire time.
+     */
+    @Override public void addNearWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long expireTime) {
+
+        nearKey = key;
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            nearEntryProcessor = entryProcessor;
+        }
+        else
+            nearVal = val;
+
+        if (ttl >= 0)
+            nearTtl = ttl;
+
+        if (expireTime >= 0)
+            nearExpireTime = expireTime;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Node ID.
+     */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @return Subject ID.
+     */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /**
+     * @return Task name.
+     */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /**
+     * @return Keys size.
+     */
+    @Override public int size() {
+        return key != null ? 1 : 0;
+    }
+
+    /**
+     * @return Keys size.
+     */
+    @Override public int nearSize() {
+        return nearKey != null ? 1 : 0;
+    }
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * @return Write version.
+     */
+    @Override public GridCacheVersion writeVersion() {
+        return writeVer;
+    }
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /**
+     * @return Topology version.
+     */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /**
+     * @return Keys.
+     */
+    @Override public Collection<KeyCacheObject> keys() {
+        return Collections.singletonList(key);
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Key.
+     */
+    @Override public KeyCacheObject key(int idx) {
+        assert idx == 0;
+
+        return key;
+    }
+
+    /**
+     * @param idx Partition index.
+     * @return Partition id.
+     */
+    @Override public int partitionId(int idx) {
+        assert idx == 0;
+
+        return partId;
+    }
+
+    /**
+     * @param updCntr Update counter.
+     * @return Update counter.
+     */
+    @Override public Long updateCounter(int updCntr) {
+        if (updCntr != 0)
+            return null;
+
+        if (updateCntr == -1)
+            return null;
+
+        return updateCntr;
+    }
+
+    /**
+     * @param idx Near key index.
+     * @return Key.
+     */
+    @Override public KeyCacheObject nearKey(int idx) {
+        assert idx == 0;
+
+        return nearKey;
+    }
+
+    /**
+     * @return Keep binary flag.
+     */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject value(int idx) {
+        assert idx == 0;
+
+        return val;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject previousValue(int idx) {
+        assert idx == 0;
+
+        return prevVal;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject localPreviousValue(int idx) {
+        assert idx == 0;
+
+        return locPrevVal;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        assert idx == 0;
+
+        return entryProcessor;
+    }
+
+    /**
+     * @param idx Near key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        assert idx == 0;
+
+        return nearVal;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Transform closure.
+     */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
+        assert idx == 0;
+
+        return nearEntryProcessor;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        assert idx == 0;
+
+        return conflictVer;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL.
+     */
+    @Override public long ttl(int idx) {
+        assert idx == 0;
+
+        return ttl;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    @Override public long nearTtl(int idx) {
+        assert idx == 0;
+
+        return nearTtl;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    @Override public long conflictExpireTime(int idx) {
+        assert idx == 0;
+
+        return conflictExpireTime;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    @Override public long nearExpireTime(int idx) {
+        assert idx == 0;
+
+        return nearExpireTime;
+    }
+
+    /**
+     * @return {@code True} if on response flag changed.
+     */
+    @Override public boolean onResponse() {
+        return !onRes && (onRes = true);
+    }
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObject(key, cctx);
+
+        prepareMarshalCacheObject(val, cctx);
+
+        prepareMarshalCacheObject(nearKey, cctx);
+
+        prepareMarshalCacheObject(nearVal, cctx);
+
+        prepareMarshalCacheObject(prevVal, cctx);
+
+        if (forceTransformBackups) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+
+            if (entryProcessorBytes == null)
+                entryProcessorBytes = marshal(entryProcessor, cctx);
+
+            if (nearEntryProcessorBytes == null)
+                nearEntryProcessorBytes = marshal(nearEntryProcessor, cctx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObject(key, cctx, ldr);
+
+        finishUnmarshalCacheObject(val, cctx, ldr);
+
+        finishUnmarshalCacheObject(nearKey, cctx, ldr);
+
+        finishUnmarshalCacheObject(nearVal, cctx, ldr);
+
+        finishUnmarshalCacheObject(prevVal, cctx, ldr);
+
+        if (forceTransformBackups) {
+            if (entryProcessor == null)
+                entryProcessor = unmarshal(entryProcessorBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+
+            if (nearEntryProcessor == null)
+                nearEntryProcessor = unmarshal(nearEntryProcessorBytes, ctx, ldr);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeLong("conflictExpireTime", conflictExpireTime))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeMessage("conflictVer", conflictVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeByteArray("entryProcessorBytes", entryProcessorBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeMessage("key", key))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeByteArray("nearEntryProcessorBytes", nearEntryProcessorBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeLong("nearExpireTime", nearExpireTime))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeMessage("nearKey", nearKey))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeLong("nearTtl", nearTtl))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeMessage("nearVal", nearVal))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeMessage("prevVal", prevVal))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeLong("ttl", ttl))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeLong("updateCntr", updateCntr))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeMessage("val", val))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("writeVer", writeVer))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                conflictExpireTime = reader.readLong("conflictExpireTime");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictVer = reader.readMessage("conflictVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                entryProcessorBytes = reader.readByteArray("entryProcessorBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                forceTransformBackups = reader.readBoolean("forceTransformBackups");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                key = reader.readMessage("key");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearEntryProcessorBytes = reader.readByteArray("nearEntryProcessorBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                nearExpireTime = reader.readLong("nearExpireTime");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                nearKey = reader.readMessage("nearKey");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                nearTtl = reader.readLong("nearTtl");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                nearVal = reader.readMessage("nearVal");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                prevVal = reader.readMessage("prevVal");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 17:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 19:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 21:
+                ttl = reader.readLong("ttl");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                updateCntr = reader.readLong("updateCntr");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                val = reader.readMessage("val");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                writeVer = reader.readMessage("writeVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicSingleUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return -25;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 25;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicSingleUpdateRequest.class, this, "super", super.toString());
+    }
+}
\ No newline at end of file


[44/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
Review.


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

Branch: refs/heads/ignite-2523
Commit: 28c20c307d5051b89024461cb69e758eafbd7723
Parents: c814ae3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:11:39 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:11:39 2016 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |   16 +-
 .../processors/cache/GridCacheIoManager.java    |   16 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   20 +-
 .../GridDhtAtomicMultipleUpdateRequest.java     | 1093 ------------------
 .../GridDhtAtomicMultipleUpdateResponse.java    |  298 -----
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |    4 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 1093 ++++++++++++++++++
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  298 +++++
 .../GridNearAtomicMultipleUpdateRequest.java    |  989 ----------------
 .../GridNearAtomicMultipleUpdateResponse.java   |  642 ----------
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   30 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  989 ++++++++++++++++
 .../atomic/GridNearAtomicUpdateResponse.java    |  642 ++++++++++
 .../IgniteClientReconnectCacheTest.java         |    6 +-
 .../IgniteClientReconnectCollectionsTest.java   |    4 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |   12 +-
 .../IgniteCacheAtomicStopBusySelfTest.java      |   10 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   20 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    4 +-
 19 files changed, 3092 insertions(+), 3094 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 2366104..e44ad00 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -66,13 +66,13 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrep
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -356,22 +356,22 @@ public class GridIoMessageFactory implements MessageFactory {
                 break;
 
             case 38:
-                msg = new GridDhtAtomicMultipleUpdateRequest();
+                msg = new GridDhtAtomicUpdateRequest();
 
                 break;
 
             case 39:
-                msg = new GridDhtAtomicMultipleUpdateResponse();
+                msg = new GridDhtAtomicUpdateResponse();
 
                 break;
 
             case 40:
-                msg = new GridNearAtomicMultipleUpdateRequest();
+                msg = new GridNearAtomicUpdateRequest();
 
                 break;
 
             case 41:
-                msg = new GridNearAtomicMultipleUpdateResponse();
+                msg = new GridNearAtomicUpdateResponse();
 
                 break;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 2ec8dd9..48a0b9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -34,12 +34,12 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRe
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
@@ -398,9 +398,9 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 38: {
-                GridDhtAtomicMultipleUpdateRequest req = (GridDhtAtomicMultipleUpdateRequest)msg;
+                GridDhtAtomicUpdateRequest req = (GridDhtAtomicUpdateRequest)msg;
 
-                GridDhtAtomicMultipleUpdateResponse res = new GridDhtAtomicMultipleUpdateResponse(
+                GridDhtAtomicUpdateResponse res = new GridDhtAtomicUpdateResponse(
                     ctx.cacheId(),
                     req.futureVersion(),
                     ctx.deploymentEnabled());
@@ -413,9 +413,9 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 40: {
-                GridNearAtomicMultipleUpdateRequest req = (GridNearAtomicMultipleUpdateRequest)msg;
+                GridNearAtomicUpdateRequest req = (GridNearAtomicUpdateRequest)msg;
 
-                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(
+                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
                     ctx.cacheId(),
                     nodeId,
                     req.futureVersion(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 6965a9c..4c07bf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -252,8 +252,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateRequest.class, new CI2<UUID, GridNearAtomicMultipleUpdateRequest>() {
-            @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateRequest req) {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateRequest.class, new CI2<UUID, GridNearAtomicUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicUpdateRequest req) {
                 processNearAtomicUpdateRequest(nodeId, req);
             }
         });
@@ -264,8 +264,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateResponse.class, new CI2<UUID, GridNearAtomicMultipleUpdateResponse>() {
-            @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateResponse.class, new CI2<UUID, GridNearAtomicUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicUpdateResponse res) {
                 processNearAtomicUpdateResponse(nodeId, res);
             }
         });
@@ -276,8 +276,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateRequest.class, new CI2<UUID, GridDhtAtomicMultipleUpdateRequest>() {
-            @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateRequest req) {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateRequest.class, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicUpdateRequest req) {
                 processDhtAtomicUpdateRequest(nodeId, req);
             }
         });
@@ -288,8 +288,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateResponse.class, new CI2<UUID, GridDhtAtomicMultipleUpdateResponse>() {
-            @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateResponse res) {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateResponse.class, new CI2<UUID, GridDhtAtomicUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicUpdateResponse res) {
                 processDhtAtomicUpdateResponse(nodeId, res);
             }
         });
@@ -1365,7 +1365,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             res = new GridNearAtomicSingleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
                 ctx.deploymentEnabled());
         else
-            res = new GridNearAtomicMultipleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
+            res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
                 ctx.deploymentEnabled());
 
         List<KeyCacheObject> keys = req.keys();
@@ -2831,7 +2831,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             res = new GridDhtAtomicSingleUpdateResponse(ctx.cacheId(), req.futureVersion(),
                 ctx.deploymentEnabled());
         else
-            res = new GridDhtAtomicMultipleUpdateResponse(ctx.cacheId(), req.futureVersion(),
+            res = new GridDhtAtomicUpdateResponse(ctx.cacheId(), req.futureVersion(),
                 ctx.deploymentEnabled());
 
         Boolean replicate = ctx.isDrEnabled();

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
deleted file mode 100644
index 2fb5065..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
+++ /dev/null
@@ -1,1093 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Lite dht cache backup update request.
- */
-public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Node ID. */
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Write version. */
-    private GridCacheVersion writeVer;
-
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Previous values. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> prevVals;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** TTLs. */
-    private GridLongList ttls;
-
-    /** Conflict expire time. */
-    private GridLongList conflictExpireTimes;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
-    /** Write synchronization mode. */
-    private CacheWriteSynchronizationMode syncMode;
-
-    /** Near cache keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearKeys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
-    /** Force transform backups flag. */
-    private boolean forceTransformBackups;
-
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Near entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
-
-    /** Near entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> nearEntryProcessorsBytes;
-
-    /** Optional arguments for entry processor. */
-    @GridDirectTransient
-    private Object[] invokeArgs;
-
-    /** Entry processor arguments bytes. */
-    private byte[][] invokeArgsBytes;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /** Task name hash. */
-    private int taskNameHash;
-
-    /** Partition. */
-    private GridLongList updateCntrs;
-
-    /** On response flag. Access should be synced on future. */
-    @GridDirectTransient
-    private boolean onRes;
-
-    /** */
-    @GridDirectTransient
-    private List<Integer> partIds;
-
-    /** */
-    @GridDirectTransient
-    private List<CacheObject> locPrevVals;
-
-    /** Keep binary flag. */
-    private boolean keepBinary;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridDhtAtomicMultipleUpdateRequest() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID.
-     * @param futVer Future version.
-     * @param writeVer Write version for cache values.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param syncMode Cache write synchronization mode.
-     * @param topVer Topology version.
-     * @param forceTransformBackups Force transform backups flag.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param addDepInfo Deployment info.
-     */
-    public GridDhtAtomicMultipleUpdateRequest(
-        int cacheId,
-        UUID nodeId,
-        GridCacheVersion futVer,
-        GridCacheVersion writeVer,
-        CacheWriteSynchronizationMode syncMode,
-        @NotNull AffinityTopologyVersion topVer,
-        boolean forceTransformBackups,
-        UUID subjId,
-        int taskNameHash,
-        Object[] invokeArgs,
-        boolean addDepInfo,
-        boolean keepBinary
-    ) {
-        assert invokeArgs == null || forceTransformBackups;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.writeVer = writeVer;
-        this.syncMode = syncMode;
-        this.topVer = topVer;
-        this.forceTransformBackups = forceTransformBackups;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.invokeArgs = invokeArgs;
-        this.addDepInfo = addDepInfo;
-        this.keepBinary = keepBinary;
-
-        keys = new ArrayList<>();
-        partIds = new ArrayList<>();
-        locPrevVals = new ArrayList<>();
-
-        if (forceTransformBackups) {
-            entryProcessors = new ArrayList<>();
-            entryProcessorsBytes = new ArrayList<>();
-        }
-        else
-            vals = new ArrayList<>();
-    }
-
-    /**
-     * @return Force transform backups flag.
-     */
-    @Override public boolean forceTransformBackups() {
-        return forceTransformBackups;
-    }
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL (optional).
-     * @param conflictExpireTime Conflict expire time (optional).
-     * @param conflictVer Conflict version (optional).
-     * @param addPrevVal If {@code true} adds previous value.
-     * @param prevVal Previous value.
-     */
-    @Override public void addWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean addPrevVal,
-        int partId,
-        @Nullable CacheObject prevVal,
-        @Nullable Long updateCntr,
-        boolean storeLocPrevVal) {
-        keys.add(key);
-
-        partIds.add(partId);
-
-        if (storeLocPrevVal) {
-            if (locPrevVals == null)
-                locPrevVals = new ArrayList<>();
-
-            locPrevVals.add(prevVal);
-        }
-
-        if (forceTransformBackups) {
-            assert entryProcessor != null;
-
-            entryProcessors.add(entryProcessor);
-        }
-        else
-            vals.add(val);
-
-        if (addPrevVal) {
-            if (prevVals == null)
-                prevVals = new ArrayList<>();
-
-            prevVals.add(prevVal);
-        }
-
-        if (updateCntr != null) {
-            if (updateCntrs == null)
-                updateCntrs = new GridLongList();
-
-            updateCntrs.add(updateCntr);
-        }
-
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>();
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (ttl >= 0) {
-            if (ttls == null) {
-                ttls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    ttls.add(CU.TTL_NOT_CHANGED);
-            }
-        }
-
-        if (ttls != null)
-            ttls.add(ttl);
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-        }
-
-        if (conflictExpireTimes != null)
-            conflictExpireTimes.add(conflictExpireTime);
-    }
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL.
-     * @param expireTime Expire time.
-     */
-    @Override public void addNearWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long expireTime) {
-        if (nearKeys == null) {
-            nearKeys = new ArrayList<>();
-
-            if (forceTransformBackups) {
-                nearEntryProcessors = new ArrayList<>();
-                nearEntryProcessorsBytes = new ArrayList<>();
-            }
-            else
-                nearVals = new ArrayList<>();
-        }
-
-        nearKeys.add(key);
-
-        if (forceTransformBackups) {
-            assert entryProcessor != null;
-
-            nearEntryProcessors.add(entryProcessor);
-        }
-        else
-            nearVals.add(val);
-
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(nearKeys.size());
-
-                for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearTtls.add(CU.TTL_NOT_CHANGED);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
-
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(nearKeys.size());
-
-                for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /**
-     * @return Node ID.
-     */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /**
-     * @return Subject ID.
-     */
-    @Override public UUID subjectId() {
-        return subjId;
-    }
-
-    /**
-     * @return Task name.
-     */
-    @Override public int taskNameHash() {
-        return taskNameHash;
-    }
-
-    /**
-     * @return Keys size.
-     */
-    @Override public int size() {
-        return keys.size();
-    }
-
-    /**
-     * @return Keys size.
-     */
-    @Override public int nearSize() {
-        return nearKeys != null ? nearKeys.size() : 0;
-    }
-
-    /**
-     * @return Version assigned on primary node.
-     */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /**
-     * @return Write version.
-     */
-    @Override public GridCacheVersion writeVersion() {
-        return writeVer;
-    }
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return syncMode;
-    }
-
-    /**
-     * @return Topology version.
-     */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return topVer;
-    }
-
-    /**
-     * @return Keys.
-     */
-    @Override public Collection<KeyCacheObject> keys() {
-        return keys;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Key.
-     */
-    @Override public KeyCacheObject key(int idx) {
-        return keys.get(idx);
-    }
-
-    /**
-     * @param idx Partition index.
-     * @return Partition id.
-     */
-    @Override public int partitionId(int idx) {
-        return partIds.get(idx);
-    }
-
-    /**
-     * @param updCntr Update counter.
-     * @return Update counter.
-     */
-    @Override public Long updateCounter(int updCntr) {
-        if (updateCntrs != null && updCntr < updateCntrs.size())
-            return updateCntrs.get(updCntr);
-
-        return null;
-    }
-
-    /**
-     * @param idx Near key index.
-     * @return Key.
-     */
-    @Override public KeyCacheObject nearKey(int idx) {
-        return nearKeys.get(idx);
-    }
-
-    /**
-     * @return Keep binary flag.
-     */
-    @Override public boolean keepBinary() {
-        return keepBinary;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Override @Nullable public CacheObject value(int idx) {
-        if (vals != null)
-            return vals.get(idx);
-
-        return null;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Override @Nullable public CacheObject previousValue(int idx) {
-        if (prevVals != null)
-            return prevVals.get(idx);
-
-        return null;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Override @Nullable public CacheObject localPreviousValue(int idx) {
-        assert locPrevVals != null;
-
-        return locPrevVals.get(idx);
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
-        return entryProcessors == null ? null : entryProcessors.get(idx);
-    }
-
-    /**
-     * @param idx Near key index.
-     * @return Value.
-     */
-    @Override @Nullable public CacheObject nearValue(int idx) {
-        if (nearVals != null)
-            return nearVals.get(idx);
-
-        return null;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Transform closure.
-     */
-    @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
-        return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
-    }
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
-
-        return null;
-    }
-
-    /**
-     * @param idx Index.
-     * @return TTL.
-     */
-    @Override public long ttl(int idx) {
-        if (ttls != null) {
-            assert idx >= 0 && idx < ttls.size();
-
-            return ttls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    @Override public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    @Override public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
-
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    @Override public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /**
-     * @return {@code True} if on response flag changed.
-     */
-    @Override public boolean onResponse() {
-        return !onRes && (onRes = true);
-    }
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Override @Nullable public Object[] invokeArguments() {
-        return invokeArgs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(keys, cctx);
-
-        prepareMarshalCacheObjects(vals, cctx);
-
-        prepareMarshalCacheObjects(nearKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
-
-        prepareMarshalCacheObjects(prevVals, cctx);
-
-        if (forceTransformBackups) {
-            // force addition of deployment info for entry processors if P2P is enabled globally.
-            if (!addDepInfo && ctx.deploymentEnabled())
-                addDepInfo = true;
-
-            if (invokeArgsBytes == null)
-                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
-
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
-            if (nearEntryProcessorsBytes == null)
-                nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, cctx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(vals, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
-
-        finishUnmarshalCacheObjects(prevVals, cctx, ldr);
-
-        if (forceTransformBackups) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
-            if (invokeArgs == null)
-                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
-
-            if (nearEntryProcessors == null)
-                nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeCollection("nearKeys", nearKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 14:
-                if (!writer.writeMessage("nearTtls", nearTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
-                if (!writer.writeCollection("prevVals", prevVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 17:
-                if (!writer.writeUuid("subjId", subjId))
-                    return false;
-
-                writer.incrementState();
-
-            case 18:
-                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 19:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
-                    return false;
-
-                writer.incrementState();
-
-            case 20:
-                if (!writer.writeMessage("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 21:
-                if (!writer.writeMessage("ttls", ttls))
-                    return false;
-
-                writer.incrementState();
-
-            case 22:
-                if (!writer.writeMessage("updateCntrs", updateCntrs))
-                    return false;
-
-                writer.incrementState();
-
-            case 23:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 24:
-                if (!writer.writeMessage("writeVer", writeVer))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                forceTransformBackups = reader.readBoolean("forceTransformBackups");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                keepBinary = reader.readBoolean("keepBinary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                nearKeys = reader.readCollection("nearKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 14:
-                nearTtls = reader.readMessage("nearTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 15:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 16:
-                prevVals = reader.readCollection("prevVals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 17:
-                subjId = reader.readUuid("subjId");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 18:
-                byte syncModeOrd;
-
-                syncModeOrd = reader.readByte("syncMode");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
-
-                reader.incrementState();
-
-            case 19:
-                taskNameHash = reader.readInt("taskNameHash");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 20:
-                topVer = reader.readMessage("topVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 21:
-                ttls = reader.readMessage("ttls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 22:
-                updateCntrs = reader.readMessage("updateCntrs");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 23:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 24:
-                writeVer = reader.readMessage("writeVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridDhtAtomicMultipleUpdateRequest.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        cleanup();
-    }
-
-    /**
-     * Cleanup values not needed after message was sent.
-     */
-    private void cleanup() {
-        nearVals = null;
-        prevVals = null;
-
-        // Do not keep values if they are not needed for continuous query notification.
-        if (locPrevVals == null) {
-            keys = null;
-            vals = null;
-            locPrevVals = null;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 38;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 25;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtAtomicMultipleUpdateRequest.class, this, "super", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
deleted file mode 100644
index 1c599c7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * DHT atomic cache backup update response.
- */
-public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> failedKeys;
-
-    /** Update error. */
-    @GridDirectTransient
-    private IgniteCheckedException err;
-
-    /** Serialized update error. */
-    private byte[] errBytes;
-
-    /** Evicted readers. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearEvicted;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridDhtAtomicMultipleUpdateResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param cacheId Cache ID.
-     * @param futVer Future version.
-     * @param addDepInfo Deployment info.
-     */
-    public GridDhtAtomicMultipleUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
-        this.cacheId = cacheId;
-        this.futVer = futVer;
-        this.addDepInfo = addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /**
-     * @return Future version.
-     */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    @Override public void onError(IgniteCheckedException err) {
-        this.err = err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteCheckedException error() {
-        return err;
-    }
-
-    /**
-     * @return Failed keys.
-     */
-    @Override public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
-    }
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>();
-
-        failedKeys.add(key);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /**
-     * @return Evicted readers.
-     */
-    @Override public Collection<KeyCacheObject> nearEvicted() {
-        return nearEvicted;
-    }
-
-    /**
-     * Adds near evicted key..
-     *
-     * @param key Evicted key.
-     */
-    @Override public void addNearEvicted(KeyCacheObject key) {
-        if (nearEvicted == null)
-            nearEvicted = new ArrayList<>();
-
-        nearEvicted.add(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(failedKeys, cctx);
-
-        prepareMarshalCacheObjects(nearEvicted, cctx);
-
-        if (errBytes == null)
-            errBytes = ctx.marshaller().marshal(err);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
-
-        if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeByteArray("errBytes", errBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                errBytes = reader.readByteArray("errBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridDhtAtomicMultipleUpdateResponse.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 39;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 7;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtAtomicMultipleUpdateResponse.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 6e2ed31..82cae3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -266,7 +266,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                             cctx.deploymentEnabled(),
                             this.updateReq.keepBinary());
                     else
-                        updateReq = new GridDhtAtomicMultipleUpdateRequest(
+                        updateReq = new GridDhtAtomicUpdateRequest(
                             cctx.cacheId(),
                             nodeId,
                             futVer,
@@ -362,7 +362,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                         cctx.deploymentEnabled(),
                         this.updateReq.keepBinary());
                 else
-                    updateReq = new GridDhtAtomicMultipleUpdateRequest(
+                    updateReq = new GridDhtAtomicUpdateRequest(
                         cctx.cacheId(),
                         nodeId,
                         futVer,

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
new file mode 100644
index 0000000..c7c940c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -0,0 +1,1093 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Lite dht cache backup update request.
+ */
+public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Write version. */
+    private GridCacheVersion writeVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Previous values. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> prevVals;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** TTLs. */
+    private GridLongList ttls;
+
+    /** Conflict expire time. */
+    private GridLongList conflictExpireTimes;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Near cache keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearKeys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Force transform backups flag. */
+    private boolean forceTransformBackups;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Near entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
+
+    /** Near entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> nearEntryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Partition. */
+    private GridLongList updateCntrs;
+
+    /** On response flag. Access should be synced on future. */
+    @GridDirectTransient
+    private boolean onRes;
+
+    /** */
+    @GridDirectTransient
+    private List<Integer> partIds;
+
+    /** */
+    @GridDirectTransient
+    private List<CacheObject> locPrevVals;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param writeVer Write version for cache values.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param syncMode Cache write synchronization mode.
+     * @param topVer Topology version.
+     * @param forceTransformBackups Force transform backups flag.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        GridCacheVersion writeVer,
+        CacheWriteSynchronizationMode syncMode,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean forceTransformBackups,
+        UUID subjId,
+        int taskNameHash,
+        Object[] invokeArgs,
+        boolean addDepInfo,
+        boolean keepBinary
+    ) {
+        assert invokeArgs == null || forceTransformBackups;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.writeVer = writeVer;
+        this.syncMode = syncMode;
+        this.topVer = topVer;
+        this.forceTransformBackups = forceTransformBackups;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.invokeArgs = invokeArgs;
+        this.addDepInfo = addDepInfo;
+        this.keepBinary = keepBinary;
+
+        keys = new ArrayList<>();
+        partIds = new ArrayList<>();
+        locPrevVals = new ArrayList<>();
+
+        if (forceTransformBackups) {
+            entryProcessors = new ArrayList<>();
+            entryProcessorsBytes = new ArrayList<>();
+        }
+        else
+            vals = new ArrayList<>();
+    }
+
+    /**
+     * @return Force transform backups flag.
+     */
+    @Override public boolean forceTransformBackups() {
+        return forceTransformBackups;
+    }
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
+     * @param addPrevVal If {@code true} adds previous value.
+     * @param prevVal Previous value.
+     */
+    @Override public void addWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean addPrevVal,
+        int partId,
+        @Nullable CacheObject prevVal,
+        @Nullable Long updateCntr,
+        boolean storeLocPrevVal) {
+        keys.add(key);
+
+        partIds.add(partId);
+
+        if (storeLocPrevVal) {
+            if (locPrevVals == null)
+                locPrevVals = new ArrayList<>();
+
+            locPrevVals.add(prevVal);
+        }
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            entryProcessors.add(entryProcessor);
+        }
+        else
+            vals.add(val);
+
+        if (addPrevVal) {
+            if (prevVals == null)
+                prevVals = new ArrayList<>();
+
+            prevVals.add(prevVal);
+        }
+
+        if (updateCntr != null) {
+            if (updateCntrs == null)
+                updateCntrs = new GridLongList();
+
+            updateCntrs.add(updateCntr);
+        }
+
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>();
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictVers.add(null);
+            }
+
+            conflictVers.add(conflictVer);
+        }
+        else if (conflictVers != null)
+            conflictVers.add(null);
+
+        if (ttl >= 0) {
+            if (ttls == null) {
+                ttls = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    ttls.add(CU.TTL_NOT_CHANGED);
+            }
+        }
+
+        if (ttls != null)
+            ttls.add(ttl);
+
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+        }
+
+        if (conflictExpireTimes != null)
+            conflictExpireTimes.add(conflictExpireTime);
+    }
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL.
+     * @param expireTime Expire time.
+     */
+    @Override public void addNearWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long expireTime) {
+        if (nearKeys == null) {
+            nearKeys = new ArrayList<>();
+
+            if (forceTransformBackups) {
+                nearEntryProcessors = new ArrayList<>();
+                nearEntryProcessorsBytes = new ArrayList<>();
+            }
+            else
+                nearVals = new ArrayList<>();
+        }
+
+        nearKeys.add(key);
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            nearEntryProcessors.add(entryProcessor);
+        }
+        else
+            nearVals.add(val);
+
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(nearKeys.size());
+
+                for (int i = 0; i < nearKeys.size() - 1; i++)
+                    nearTtls.add(CU.TTL_NOT_CHANGED);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(nearKeys.size());
+
+                for (int i = 0; i < nearKeys.size() - 1; i++)
+                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Node ID.
+     */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @return Subject ID.
+     */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /**
+     * @return Task name.
+     */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /**
+     * @return Keys size.
+     */
+    @Override public int size() {
+        return keys.size();
+    }
+
+    /**
+     * @return Keys size.
+     */
+    @Override public int nearSize() {
+        return nearKeys != null ? nearKeys.size() : 0;
+    }
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * @return Write version.
+     */
+    @Override public GridCacheVersion writeVersion() {
+        return writeVer;
+    }
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /**
+     * @return Topology version.
+     */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /**
+     * @return Keys.
+     */
+    @Override public Collection<KeyCacheObject> keys() {
+        return keys;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Key.
+     */
+    @Override public KeyCacheObject key(int idx) {
+        return keys.get(idx);
+    }
+
+    /**
+     * @param idx Partition index.
+     * @return Partition id.
+     */
+    @Override public int partitionId(int idx) {
+        return partIds.get(idx);
+    }
+
+    /**
+     * @param updCntr Update counter.
+     * @return Update counter.
+     */
+    @Override public Long updateCounter(int updCntr) {
+        if (updateCntrs != null && updCntr < updateCntrs.size())
+            return updateCntrs.get(updCntr);
+
+        return null;
+    }
+
+    /**
+     * @param idx Near key index.
+     * @return Key.
+     */
+    @Override public KeyCacheObject nearKey(int idx) {
+        return nearKeys.get(idx);
+    }
+
+    /**
+     * @return Keep binary flag.
+     */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject value(int idx) {
+        if (vals != null)
+            return vals.get(idx);
+
+        return null;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject previousValue(int idx) {
+        if (prevVals != null)
+            return prevVals.get(idx);
+
+        return null;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject localPreviousValue(int idx) {
+        assert locPrevVals != null;
+
+        return locPrevVals.get(idx);
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        return entryProcessors == null ? null : entryProcessors.get(idx);
+    }
+
+    /**
+     * @param idx Near key index.
+     * @return Value.
+     */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        if (nearVals != null)
+            return nearVals.get(idx);
+
+        return null;
+    }
+
+    /**
+     * @param idx Key index.
+     * @return Transform closure.
+     */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
+        return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
+    }
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
+
+            return conflictVers.get(idx);
+        }
+
+        return null;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL.
+     */
+    @Override public long ttl(int idx) {
+        if (ttls != null) {
+            assert idx >= 0 && idx < ttls.size();
+
+            return ttls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    @Override public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
+
+            return conflictExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /**
+     * @return {@code True} if on response flag changed.
+     */
+    @Override public boolean onResponse() {
+        return !onRes && (onRes = true);
+    }
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(keys, cctx);
+
+        prepareMarshalCacheObjects(vals, cctx);
+
+        prepareMarshalCacheObjects(nearKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        prepareMarshalCacheObjects(prevVals, cctx);
+
+        if (forceTransformBackups) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+
+            if (entryProcessorsBytes == null)
+                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+            if (nearEntryProcessorsBytes == null)
+                nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, cctx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        finishUnmarshalCacheObjects(prevVals, cctx, ldr);
+
+        if (forceTransformBackups) {
+            if (entryProcessors == null)
+                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+
+            if (nearEntryProcessors == null)
+                nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeCollection("nearKeys", nearKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeCollection("prevVals", prevVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeMessage("ttls", ttls))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeMessage("updateCntrs", updateCntrs))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("writeVer", writeVer))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                forceTransformBackups = reader.readBoolean("forceTransformBackups");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                nearKeys = reader.readCollection("nearKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                prevVals = reader.readCollection("prevVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 17:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 19:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 21:
+                ttls = reader.readMessage("ttls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                updateCntrs = reader.readMessage("updateCntrs");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                writeVer = reader.readMessage("writeVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        cleanup();
+    }
+
+    /**
+     * Cleanup values not needed after message was sent.
+     */
+    private void cleanup() {
+        nearVals = null;
+        prevVals = null;
+
+        // Do not keep values if they are not needed for continuous query notification.
+        if (locPrevVals == null) {
+            keys = null;
+            vals = null;
+            locPrevVals = null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 38;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 25;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicUpdateRequest.class, this, "super", super.toString());
+    }
+}


[32/51] [abbrv] ignite git commit: ignite-2523: Merge.

Posted by vo...@apache.org.
ignite-2523: Merge.


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

Branch: refs/heads/ignite-2523
Commit: 90fce7b9ec5c5226451cf592a9634fc66a2c9fcc
Parents: daf501c
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Fri Feb 19 16:25:46 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Fri Feb 19 16:25:46 2016 +0300

----------------------------------------------------------------------
 .../GridDhtAtomicMultipleUpdateRequest.java     | 36 +++++++++++++++++---
 .../GridDhtAtomicSingleUpdateRequest.java       | 25 ++++++++++++--
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  3 +-
 .../GridNearAtomicMultipleUpdateRequest.java    | 12 +++++++
 .../GridNearAtomicSingleUpdateRequest.java      | 13 ++++++-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  7 ++++
 6 files changed, 88 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/90fce7b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
index 40d68fa..8a0cc69 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
@@ -251,12 +251,18 @@ public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage impleme
         boolean addPrevVal,
         int partId,
         @Nullable CacheObject prevVal,
-        @Nullable Long updateIdx) {
+        @Nullable Long updateCntr,
+        boolean storeLocPrevVal) {
         keys.add(key);
 
         partIds.add(partId);
 
-        locPrevVals.add(prevVal);
+        if (storeLocPrevVal) {
+            if (locPrevVals == null)
+                locPrevVals = new ArrayList<>();
+
+            locPrevVals.add(prevVal);
+        }
 
         if (forceTransformBackups) {
             assert entryProcessor != null;
@@ -273,11 +279,11 @@ public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage impleme
             prevVals.add(prevVal);
         }
 
-        if (updateIdx != null) {
+        if (updateCntr != null) {
             if (updateCntrs == null)
                 updateCntrs = new GridLongList();
 
-            updateCntrs.add(updateIdx);
+            updateCntrs.add(updateCntr);
         }
 
         // In case there is no conflict, do not create the list.
@@ -521,6 +527,8 @@ public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage impleme
      * @return Value.
      */
     @Override @Nullable public CacheObject localPreviousValue(int idx) {
+        assert locPrevVals != null;
+
         return locPrevVals.get(idx);
     }
 
@@ -1049,6 +1057,26 @@ public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage impleme
     }
 
     /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        cleanup();
+    }
+
+    /**
+     * Cleanup values not needed after message was sent.
+     */
+    private void cleanup() {
+        nearVals = null;
+        prevVals = null;
+
+        // Do not keep values if they are not needed for continuous query notification.
+        if (locPrevVals == null) {
+            keys = null;
+            vals = null;
+            locPrevVals = null;
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public byte directType() {
         return 38;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/90fce7b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 0c0dd19..b78cc4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -216,12 +216,13 @@ public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implement
         boolean addPrevVal,
         int partId,
         @Nullable CacheObject prevVal,
-        @Nullable Long updateIdx) {
+        @Nullable Long updateIdx,
+        boolean storeLocPrevVal) {
         this.key = key;
 
         this.partId = partId;
 
-        this.locPrevVal = prevVal;
+        this.locPrevVal = storeLocPrevVal ? prevVal : null;
 
         if (forceTransformBackups) {
             assert entryProcessor != null;
@@ -940,6 +941,26 @@ public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implement
     }
 
     /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        cleanup();
+    }
+
+    /**
+     * Cleanup values not needed after message was sent.
+     */
+    private void cleanup() {
+        nearVal = null;
+        prevVal = null;
+
+        // Do not keep values if they are not needed for continuous query notification.
+        if (locPrevVal == null) {
+            key = null;
+            val = null;
+            locPrevVal = null;
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public byte directType() {
         return -25;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/90fce7b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 0ab67a6..280b98e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -47,7 +47,8 @@ public interface GridDhtAtomicUpdateRequest {
         boolean addPrevVal,
         int partId,
         @Nullable CacheObject prevVal,
-        @Nullable Long updateIdx);
+        @Nullable Long updateIdx,
+        boolean storeLocPrevVal);
 
     void addNearWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,

http://git-wip-us.apache.org/repos/asf/ignite/blob/90fce7b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index 650d350..86de2e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -959,6 +959,18 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
+    @Override public void cleanup(boolean clearKeys) {
+        vals = null;
+        entryProcessors = null;
+        entryProcessorsBytes = null;
+        invokeArgs = null;
+        invokeArgsBytes = null;
+
+        if (clearKeys)
+            keys = null;
+    }
+
+    /** {@inheritDoc} */
     @Override public byte directType() {
         return 40;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/90fce7b9/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 1e981af..94a586d 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
@@ -243,7 +243,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         if (op == TRANSFORM) {
             assert val instanceof EntryProcessor : val;
 
-            entryProc = (EntryProcessor<Object, Object, Object>) val;
+            entryProc = (EntryProcessor<Object, Object, Object>)val;
         }
 
         assert val != null || op == DELETE;
@@ -869,6 +869,17 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         return reader.afterMessageRead(GridNearAtomicSingleUpdateRequest.class);
     }
 
+    @Override public void cleanup(boolean clearKeys) {
+        val = null;
+        entryProc = null;
+        entryProcBytes = null;
+        invokeArgs = null;
+        invokeArgsBytes = null;
+
+        if (clearKeys)
+            key = null;
+    }
+
     /** {@inheritDoc} */
     @Override public byte directType() {
         return -23;

http://git-wip-us.apache.org/repos/asf/ignite/blob/90fce7b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 960add7..bf93559 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -196,4 +196,11 @@ public interface GridNearAtomicUpdateRequest {
      * @return Response.
      */
     @Nullable public GridNearAtomicUpdateResponse response();
+
+    /**
+     * Cleanup values.
+     *
+     * @param clearKeys If {@code true} clears keys.
+     */
+    void cleanup(boolean clearKeys);
 }


[38/51] [abbrv] ignite git commit: ignite-2523 : Fixed problems found during review.

Posted by vo...@apache.org.
ignite-2523 : Fixed problems found during review.


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

Branch: refs/heads/ignite-2523
Commit: 6ce4d22354ff5a17da24571088db46bc0eb26327
Parents: 82a848d
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Thu Feb 25 14:54:34 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Thu Feb 25 14:54:34 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheIoManager.java    | 55 +++++++++++---------
 .../GridDhtAtomicSingleUpdateRequest.java       | 21 ++++++--
 .../GridDhtAtomicSingleUpdateResponse.java      |  6 +--
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   | 14 ++---
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  3 --
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  3 --
 .../GridNearAtomicSingleUpdateResponse.java     | 18 +++----
 .../atomic/GridNearAtomicUpdateResponse.java    |  5 --
 .../distributed/near/GridNearAtomicCache.java   | 25 ++++-----
 9 files changed, 75 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index a4ad500..2ec8dd9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -17,14 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
@@ -46,11 +38,9 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDh
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -78,6 +68,14 @@ import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
 
 import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
 
@@ -400,24 +398,16 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 38: {
-                GridDhtAtomicUpdateRequest req = (GridDhtAtomicUpdateRequest)msg;
+                GridDhtAtomicMultipleUpdateRequest req = (GridDhtAtomicMultipleUpdateRequest)msg;
 
-                GridDhtAtomicUpdateResponse res;
-
-                if (req instanceof GridDhtAtomicSingleUpdateRequest)
-                    res = new GridDhtAtomicSingleUpdateResponse(
-                        ctx.cacheId(),
-                        req.futureVersion(),
-                        ctx.deploymentEnabled());
-                else
-                    res = new GridDhtAtomicMultipleUpdateResponse(
-                        ctx.cacheId(),
-                        req.futureVersion(),
-                        ctx.deploymentEnabled());
+                GridDhtAtomicMultipleUpdateResponse res = new GridDhtAtomicMultipleUpdateResponse(
+                    ctx.cacheId(),
+                    req.futureVersion(),
+                    ctx.deploymentEnabled());
 
                 res.onError(req.classError());
 
-                sendResponseOnFailedMessage(nodeId, (GridCacheMessage) res, cctx, ctx.ioPolicy());
+                sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
             }
 
             break;
@@ -616,6 +606,21 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
 
             break;
 
+            case -25: {
+                GridDhtAtomicSingleUpdateRequest req = (GridDhtAtomicSingleUpdateRequest)msg;
+
+                GridDhtAtomicSingleUpdateResponse res = new GridDhtAtomicSingleUpdateResponse(
+                    ctx.cacheId(),
+                    req.futureVersion(),
+                    ctx.deploymentEnabled());
+
+                res.onError(req.classError());
+
+                sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+            }
+
+            break;
+
             default:
                 throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message="
                     + msg + "]", msg.classError());

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 4e91429..2b29df6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -29,7 +28,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -41,10 +39,8 @@ import org.jetbrains.annotations.Nullable;
 import javax.cache.processor.EntryProcessor;
 import java.io.Externalizable;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 import java.util.UUID;
 
 public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
@@ -66,47 +62,64 @@ public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implement
     /** Topology version. */
     private AffinityTopologyVersion topVer;
 
+    /** Key. */
     @GridToStringInclude
     private KeyCacheObject key;
 
+    /** Value. */
     @GridToStringInclude
     private CacheObject val;
 
+    /** Previous value. */
     @GridToStringInclude
     private CacheObject prevVal;
 
+    /** Conflict version. */
     @GridToStringInclude
     private GridCacheVersion conflictVer;
 
+    /** TTL. */
     private long ttl = CU.TTL_NOT_CHANGED;
 
+    /** Conflict expire time. */
     private long conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
 
+    /** Near TTL. */
     private long nearTtl = CU.TTL_NOT_CHANGED;
 
+    /** Near expire time. */
     private long nearExpireTime = CU.EXPIRE_TIME_CALCULATE;
 
+    /** Near key. */
     @GridToStringInclude
     private KeyCacheObject nearKey;
 
+    /** Near value. */
     @GridToStringInclude
     private CacheObject nearVal;
 
+    /** Entry processor. */
     @GridDirectTransient
     private EntryProcessor<Object, Object, Object> entryProcessor;
 
+    /** Entry processor bytes. */
     private byte[] entryProcessorBytes;
 
+    /** Near entry processor. */
     @GridDirectTransient
     private EntryProcessor<Object, Object, Object> nearEntryProcessor;
 
+    /** Near entry processor bytes. */
     private byte[] nearEntryProcessorBytes;
 
+    /** Update counter. */
     private long updateCntr = -1;
 
+    /** Partition ID. */
     @GridDirectTransient
     private int partId;
 
+    /** Local previous value. */
     @GridDirectTransient
     private CacheObject locPrevVal;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index c8ae721..fc5a8b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
@@ -29,15 +28,12 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import java.io.Externalizable;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 
 public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
     /** */
@@ -49,9 +45,11 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
     /** Future version. */
     private GridCacheVersion futVer;
 
+    /** Failed key. */
     @GridToStringInclude
     private KeyCacheObject failedKey;
 
+    /** Near evicted key. */
     @GridToStringInclude
     private KeyCacheObject nearEvicted;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 6823d77..df50542 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -17,13 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.cache.processor.EntryProcessor;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -49,6 +42,13 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
+import javax.cache.processor.EntryProcessor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
 
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 1e9fcd2..3e97462 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -26,11 +26,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
 import javax.cache.processor.EntryProcessor;
-import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.UUID;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 8076245..6fa9c4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -23,9 +23,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import java.nio.ByteBuffer;
 import java.util.Collection;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index 9319b64..c7e5c8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -28,16 +27,13 @@ import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
-
 import java.io.Externalizable;
 import java.nio.ByteBuffer;
 import java.util.Collection;
@@ -71,31 +67,33 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
     @GridToStringInclude
     private GridCacheReturn ret;
 
+    /** Key. */
     private KeyCacheObject key;
 
+    /** Failed. */
     private boolean failed;
 
+    /** Remap. */
     private boolean remap;
 
+    /** Has near value. */
     private boolean hasNearVal;
 
+    /** Near value. */
     private CacheObject nearVal;
 
+    /** Skipped near update. */
     private boolean nearSkip;
 
+    /** Near TTL. */
     private long nearTtl = -1;
 
+    /** Near expire time. */
     private long nearExpireTime = -1;
 
     /** Version generated on primary node to be used for originating node's near cache update. */
     private GridCacheVersion nearVer;
 
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
     /**
      * Empty constructor required by {@link Externalizable}.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 4d261f3..4c4e8c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -26,12 +26,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.List;
 import java.util.UUID;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ce4d223/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 168076a..4f133e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -17,16 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
-import java.io.Externalizable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.EntryProcessorException;
-import javax.cache.processor.EntryProcessorResult;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -43,7 +33,6 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
@@ -61,11 +50,19 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.security.SecurityPermission;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.EntryProcessorResult;
+import java.io.Externalizable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
 import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
 
 /**


[37/51] [abbrv] ignite git commit: Fixed copyrights and javadocs.

Posted by vo...@apache.org.
Fixed copyrights and javadocs.


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

Branch: refs/heads/ignite-2523
Commit: 82a848d1776f4ebccc730c9b22a636b93328f959
Parents: 4318860
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Thu Feb 25 12:32:26 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Thu Feb 25 12:32:26 2016 +0300

----------------------------------------------------------------------
 .../GridDhtAtomicSingleUpdateRequest.java       |  26 ++-
 .../GridDhtAtomicSingleUpdateResponse.java      |  26 ++-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 188 ++++++++++++++++---
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  98 +++++++---
 .../GridNearAtomicMultipleUpdateResponse.java   |   9 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |   3 +-
 .../atomic/GridNearAtomicUpdateResponse.java    | 132 ++++++++++++-
 7 files changed, 394 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index b78cc4a..4e91429 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -1,20 +1,18 @@
 /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  * contributor license agreements.  See the NOTICE file distributed with
- *  * this work for additional information regarding copyright ownership.
- *  * The ASF licenses this file to You under the Apache License, Version 2.0
- *  * (the "License"); you may not use this file except in compliance with
- *  * the License.  You may obtain a copy of the License at
- *  *
- *  *      http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;

http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index 4930968..c8ae721 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -1,20 +1,18 @@
 /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  * contributor license agreements.  See the NOTICE file distributed with
- *  * this work for additional information regarding copyright ownership.
- *  * The ASF licenses this file to You under the Apache License, Version 2.0
- *  * (the "License"); you may not use this file except in compliance with
- *  * the License.  You may obtain a copy of the License at
- *  *
- *  *      http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;

http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 280b98e..1e9fcd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -1,20 +1,18 @@
 /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  * contributor license agreements.  See the NOTICE file distributed with
- *  * this work for additional information regarding copyright ownership.
- *  * The ASF licenses this file to You under the Apache License, Version 2.0
- *  * (the "License"); you may not use this file except in compliance with
- *  * the License.  You may obtain a copy of the License at
- *  *
- *  *      http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
@@ -23,9 +21,11 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
@@ -34,10 +34,26 @@ import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.UUID;
 
-public interface GridDhtAtomicUpdateRequest {
+/**
+ * Base interface for DHT atomic update requests.
+ */
+public interface GridDhtAtomicUpdateRequest extends Message {
 
+    /**
+     * @return Force transform backups flag.
+     */
     boolean forceTransformBackups();
 
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
+     * @param addPrevVal If {@code true} adds previous value.
+     * @param prevVal Previous value.
+     */
     void addWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,
         EntryProcessor<Object, Object, Object> entryProcessor,
@@ -50,83 +66,209 @@ public interface GridDhtAtomicUpdateRequest {
         @Nullable Long updateIdx,
         boolean storeLocPrevVal);
 
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL.
+     * @param expireTime Expire time.
+     */
     void addNearWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,
         EntryProcessor<Object, Object, Object> entryProcessor,
         long ttl,
         long expireTime);
 
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
     int lookupIndex();
 
+    /**
+     * @return Node ID.
+     */
     UUID nodeId();
 
+    /**
+     * @return Subject ID.
+     */
     UUID subjectId();
 
+    /**
+     * @return Task name.
+     */
     int taskNameHash();
 
+    /**
+     * @return Keys size.
+     */
     int size();
 
+    /**
+     * @return Keys size.
+     */
     int nearSize();
 
+    /**
+     * @return Version assigned on primary node.
+     */
     GridCacheVersion futureVersion();
 
+    /**
+     * @return Write version.
+     */
     GridCacheVersion writeVersion();
 
+    /**
+     * @return Cache write synchronization mode.
+     */
     CacheWriteSynchronizationMode writeSynchronizationMode();
 
+    /**
+     * @return Topology version.
+     */
     AffinityTopologyVersion topologyVersion();
 
+    /**
+     * @return Keys.
+     */
     Collection<KeyCacheObject> keys();
 
+    /**
+     * @param idx Key index.
+     * @return Key.
+     */
     KeyCacheObject key(int idx);
 
+    /**
+     * @param idx Partition index.
+     * @return Partition id.
+     */
     int partitionId(int idx);
 
+    /**
+     * @param updCntr Update counter.
+     * @return Update counter.
+     */
     Long updateCounter(int updCntr);
 
+    /**
+     * @param idx Near key index.
+     * @return Key.
+     */
     KeyCacheObject nearKey(int idx);
 
+    /**
+     * @return Keep binary flag.
+     */
     boolean keepBinary();
 
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
     @Nullable CacheObject value(int idx);
 
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
     @Nullable CacheObject previousValue(int idx);
 
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
     @Nullable CacheObject localPreviousValue(int idx);
 
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
     @Nullable EntryProcessor<Object, Object, Object> entryProcessor(int idx);
 
+    /**
+     * @param idx Near key index.
+     * @return Value.
+     */
     @Nullable CacheObject nearValue(int idx);
 
+    /**
+     * @param idx Key index.
+     * @return Transform closure.
+     */
     @Nullable EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
 
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
     @Nullable GridCacheVersion conflictVersion(int idx);
 
+    /**
+     * @param idx Index.
+     * @return TTL.
+     */
     long ttl(int idx);
 
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
     long nearTtl(int idx);
 
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
     long conflictExpireTime(int idx);
 
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
     long nearExpireTime(int idx);
 
+    /**
+     * @return {@code True} if on response flag changed.
+     */
     boolean onResponse();
 
+    /**
+     * @return Optional arguments for entry processor.
+     */
     @Nullable Object[] invokeArguments();
 
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
     void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
 
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
     void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
 
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
     boolean addDeploymentInfo();
 
-    boolean writeTo(ByteBuffer buf, MessageWriter writer);
-
-    boolean readFrom(ByteBuffer buf, MessageReader reader);
-
-    byte directType();
-
-    byte fieldsCount();
-
+    /**
+     * @return Error.
+     */
     IgniteCheckedException classError();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index a74fed6..8076245 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -1,63 +1,115 @@
 /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  * contributor license agreements.  See the NOTICE file distributed with
- *  * this work for additional information regarding copyright ownership.
- *  * The ASF licenses this file to You under the Apache License, Version 2.0
- *  * (the "License"); you may not use this file except in compliance with
- *  * the License.  You may obtain a copy of the License at
- *  *
- *  *      http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import java.nio.ByteBuffer;
 import java.util.Collection;
 
-public interface GridDhtAtomicUpdateResponse {
+/**
+ * Base interface for DHT atomic update responses.
+ */
+public interface GridDhtAtomicUpdateResponse extends Message {
+
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
     int lookupIndex();
 
+    /**
+     * @return Version assigned on primary node.
+     */
     GridCacheVersion futureVersion();
 
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
     void onError(IgniteCheckedException err);
 
+    /**
+     * @return Error, if any.
+     */
     IgniteCheckedException error();
 
+    /**
+     * @return Failed keys.
+     */
     Collection<KeyCacheObject> failedKeys();
 
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
     void addFailedKey(KeyCacheObject key, Throwable e);
 
+    /**
+     * @return Evicted readers.
+     */
     Collection<KeyCacheObject> nearEvicted();
 
+    /**
+     * Adds near evicted key..
+     *
+     * @param key Evicted key.
+     */
     void addNearEvicted(KeyCacheObject key);
 
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
     void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
 
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
     void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
 
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
     boolean addDeploymentInfo();
 
-    boolean writeTo(ByteBuffer buf, MessageWriter writer);
-
-    boolean readFrom(ByteBuffer buf, MessageReader reader);
-
-    byte directType();
-
-    byte fieldsCount();
-
+    /**
+     * @return Message ID.
+     */
     long messageId();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
index da6d061..cbab328 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -157,7 +157,7 @@ public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage imple
      *
      * @param err Error.
      */
-    @Override public void error(IgniteCheckedException err){
+    @Override public void error(IgniteCheckedException err) {
         this.err = err;
     }
 
@@ -321,9 +321,9 @@ public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage imple
     /**
      * @return Indexes of keys for which values were generated on primary node.
      */
-   @Override @Nullable public List<Integer> nearValuesIndexes() {
+    @Override @Nullable public List<Integer> nearValuesIndexes() {
         return nearValsIdxs;
-   }
+    }
 
     /**
      * @param idx Index.
@@ -378,7 +378,8 @@ public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage imple
      * @param e Error cause.
      * @param ctx Context.
      */
-    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx) {
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
+        GridCacheContext ctx) {
         if (failedKeys == null)
             failedKeys = new ArrayList<>(keys.size());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index bf93559..b2d847b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheOperation;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
 import org.jetbrains.annotations.Nullable;
 
 import javax.cache.expiry.ExpiryPolicy;
@@ -34,7 +35,7 @@ import java.util.UUID;
 /**
  * Base interface for near atomic update requests.
  */
-public interface GridNearAtomicUpdateRequest {
+public interface GridNearAtomicUpdateRequest extends Message {
     /**
      * @return Message ID.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/82a848d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 51d388c..4d261f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -20,83 +20,197 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
 
+import java.io.Externalizable;
 import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.List;
 import java.util.UUID;
 
-public interface GridNearAtomicUpdateResponse {
+/**
+ * Base interface for near atomic update responses.
+ */
+public interface GridNearAtomicUpdateResponse extends Message {
 
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
     int lookupIndex();
 
+    /**
+     * @return Mapped node ID.
+     */
     UUID nodeId();
 
+    /**
+     * @param nodeId Node ID.
+     */
     void nodeId(UUID nodeId);
 
+    /**
+     * @return Future version.
+     */
     GridCacheVersion futureVersion();
 
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
     void error(IgniteCheckedException err);
 
+    /**
+     * @return Error, if any.
+     */
     IgniteCheckedException error();
 
+    /**
+     * @return Collection of failed keys.
+     */
     Collection<KeyCacheObject> failedKeys();
 
+    /**
+     * @return Return value.
+     */
     GridCacheReturn returnValue();
 
+    /**
+     * @param ret Return value.
+     */
     @SuppressWarnings("unchecked") void returnValue(GridCacheReturn ret);
 
+    /**
+     * @param remapKeys Remap keys.
+     */
     void remapKeys(List<KeyCacheObject> remapKeys);
 
+    /**
+     * @return Remap keys.
+     */
     Collection<KeyCacheObject> remapKeys();
 
+    /**
+     * Adds value to be put in near cache on originating node.
+     *
+     * @param keyIdx Key index.
+     * @param val Value.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
     void addNearValue(int keyIdx,
         @Nullable CacheObject val,
         long ttl,
         long expireTime);
 
+    /**
+     * @param keyIdx Key index.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
     @SuppressWarnings("ForLoopReplaceableByForEach") void addNearTtl(int keyIdx, long ttl, long expireTime);
 
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
     long nearExpireTime(int idx);
 
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
     long nearTtl(int idx);
 
+    /**
+     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+     */
     void nearVersion(GridCacheVersion nearVer);
 
+    /**
+     * @return Version generated on primary node to be used for originating node's near cache update.
+     */
     GridCacheVersion nearVersion();
 
+    /**
+     * @param keyIdx Index of key for which update was skipped
+     */
     void addSkippedIndex(int keyIdx);
 
+    /**
+     * @return Indexes of keys for which update was skipped
+     */
     @Nullable List<Integer> skippedIndexes();
 
+    /**
+     * @return Indexes of keys for which values were generated on primary node.
+     */
     @Nullable List<Integer> nearValuesIndexes();
 
+    /**
+     * @param idx Index.
+     * @return Value generated on primary node which should be put to originating node's near cache.
+     */
     @Nullable CacheObject nearValue(int idx);
 
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
     void addFailedKey(KeyCacheObject key, Throwable e);
 
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     */
     void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e);
 
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     * @param ctx Context.
+     */
     void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx);
 
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
     void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
 
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
     void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
 
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
     boolean addDeploymentInfo();
-
-    boolean writeTo(ByteBuffer buf, MessageWriter writer);
-
-    boolean readFrom(ByteBuffer buf, MessageReader reader);
-
-    byte directType();
-
-    byte fieldsCount();
 }


[23/51] [abbrv] ignite git commit: ignite-2523 : Generalized usage of GridNearAtomicUpdateRequest/Response.

Posted by vo...@apache.org.
ignite-2523 : Generalized usage of GridNearAtomicUpdateRequest/Response.


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

Branch: refs/heads/ignite-2523
Commit: cb5bdb3f19cefe14380ac169d49e6e86bde1899a
Parents: 3c8d02a
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Mon Feb 8 18:51:55 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Mon Feb 8 18:51:55 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 45 +++++++++++---------
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  8 ++--
 2 files changed, 30 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cb5bdb3f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index b0504db..05205e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -55,6 +55,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheOperation;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheUpdateAtomicResult;
@@ -139,7 +140,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Integer.getInteger(IGNITE_ATOMIC_DEFERRED_ACK_TIMEOUT, 500);
 
     /** Update reply closure. */
-    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> updateReplyClos;
+    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
 
     /** Pending  */
     private ConcurrentMap<UUID, DeferredResponseBuffer> pendingResponses = new ConcurrentHashMap8<>();
@@ -192,9 +193,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
+        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicMultipleUpdateResponse res) {
+            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
                 if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
                     assert req.writeSynchronizationMode() != FULL_ASYNC : req;
 
@@ -1311,7 +1312,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     public void updateAllAsyncInternal(
         final UUID nodeId,
         final GridNearAtomicUpdateRequest req,
-        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb
+        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
@@ -1336,10 +1337,16 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     public void updateAllAsyncInternal0(
         UUID nodeId,
         GridNearAtomicUpdateRequest req,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
-        GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
-            ctx.deploymentEnabled());
+        GridNearAtomicUpdateResponse res;
+
+        if (req instanceof GridNearAtomicSingleUpdateRequest)
+            res = new GridNearAtomicSingleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
+                ctx.deploymentEnabled());
+        else
+            res = new GridNearAtomicMultipleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
+                ctx.deploymentEnabled());
 
         List<KeyCacheObject> keys = req.keys();
 
@@ -1424,7 +1431,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             UpdateBatchResult updRes = updateWithBatch(node,
                                 hasNear,
                                 req,
-                                res,
+                                (GridNearAtomicMultipleUpdateResponse) res,
                                 locked,
                                 ver,
                                 dhtFut,
@@ -1563,7 +1570,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -1797,7 +1804,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                     if (intercept) {
                         CacheObject old = entry.innerGet(
-                             null,
+                            null,
                             /*read swap*/true,
                             /*read through*/ctx.loadPreviousValue(),
                             /*fail fast*/false,
@@ -1812,7 +1819,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             req.keepBinary());
 
                         Object val = ctx.config().getInterceptor().onBeforePut(new CacheLazyEntry(ctx, entry.key(),
-                            old, req.keepBinary()),
+                                old, req.keepBinary()),
                             updated.value(ctx.cacheObjectContext(), false));
 
                         if (val == null)
@@ -1975,11 +1982,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         ClusterNode node,
         boolean hasNear,
         GridNearAtomicUpdateRequest req,
-        GridNearAtomicMultipleUpdateResponse res,
+        GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2214,7 +2221,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable Collection<KeyCacheObject> rmvKeys,
         @Nullable Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         final GridNearAtomicUpdateRequest req,
         final GridNearAtomicMultipleUpdateResponse res,
         boolean replicate,
@@ -2688,8 +2695,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
         GridCacheVersion writeVer,
         GridNearAtomicUpdateRequest updateReq,
-        GridNearAtomicMultipleUpdateResponse updateRes,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
+        GridNearAtomicUpdateResponse updateRes,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         boolean force
     ) {
         if (!force) {
@@ -2944,9 +2951,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Originating node ID.
      * @param res Near update response.
      */
-    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
+    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) {
         try {
-            ctx.io().send(nodeId, res, ctx.ioPolicy());
+            ctx.io().send(nodeId, (GridCacheMessage) res, ctx.ioPolicy());
         }
         catch (ClusterTopologyCheckedException ignored) {
             U.warn(log, "Failed to send near update reply to node because it left grid: " +
@@ -3188,7 +3195,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                 respVers.add(ver);
 
-                if  (respVers.sizex() > DEFERRED_UPDATE_RESPONSE_BUFFER_SIZE && guard.compareAndSet(false, true))
+                if (respVers.sizex() > DEFERRED_UPDATE_RESPONSE_BUFFER_SIZE && guard.compareAndSet(false, true))
                     snd = true;
             }
             finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/cb5bdb3f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 68c639d..3a31700 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -77,7 +77,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
 
     /** Completion callback. */
     @GridToStringExclude
-    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb;
+    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
 
     /** Mappings. */
     @GridToStringInclude
@@ -90,7 +90,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
     private final GridNearAtomicUpdateRequest updateReq;
 
     /** Update response. */
-    private final GridNearAtomicMultipleUpdateResponse updateRes;
+    private final GridNearAtomicUpdateResponse updateRes;
 
     /** Future keys. */
     private final Collection<KeyCacheObject> keys;
@@ -110,10 +110,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public GridDhtAtomicUpdateFuture(
         GridCacheContext cctx,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
         GridCacheVersion writeVer,
         GridNearAtomicUpdateRequest updateReq,
-        GridNearAtomicMultipleUpdateResponse updateRes
+        GridNearAtomicUpdateResponse updateRes
     ) {
         this.cctx = cctx;
         this.writeVer = writeVer;


[35/51] [abbrv] ignite git commit: Merge branches 'ignite-2523' and 'master' of https://github.com/ilantukh/ignite into ignite-2523

Posted by vo...@apache.org.
Merge branches 'ignite-2523' and 'master' of https://github.com/ilantukh/ignite into ignite-2523

Conflicts:
	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java


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

Branch: refs/heads/ignite-2523
Commit: 9533cb250225c8991e1fe038d889ee5c76f69d81
Parents: 20bbd61 10214cc
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Thu Feb 25 12:11:31 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Thu Feb 25 12:11:31 2016 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteQueue.java     |  27 ++-
 .../main/java/org/apache/ignite/IgniteSet.java  |  26 ++-
 .../apache/ignite/IgniteSystemProperties.java   |   3 +
 .../internal/GridEventConsumeHandler.java       |   4 +-
 .../internal/GridMessageListenHandler.java      |   4 +-
 .../ignite/internal/IgniteComputeImpl.java      |   4 +-
 .../ignite/internal/binary/BinaryUtils.java     |   2 +-
 .../internal/managers/GridManagerAdapter.java   |   4 +-
 .../checkpoint/GridCheckpointManager.java       |   2 +-
 .../managers/communication/GridIoManager.java   |   9 +-
 .../deployment/GridDeploymentCommunication.java |   2 +-
 .../deployment/GridDeploymentLocalStore.java    |   2 +-
 .../eventstorage/GridEventStorageManager.java   |  10 +-
 .../processors/affinity/GridAffinityUtils.java  |   3 +-
 .../cache/CacheEntrySerializablePredicate.java  |   3 +-
 .../cache/CacheInvokeDirectResult.java          |   3 +-
 .../processors/cache/GridCacheAdapter.java      |   5 +-
 .../cache/GridCacheDeploymentManager.java       |   5 +
 .../processors/cache/GridCacheMessage.java      |   4 +-
 .../processors/cache/GridCacheMvccManager.java  | 142 ++++++++++------
 .../processors/cache/GridCacheProcessor.java    |   5 +-
 .../GridDistributedLockResponse.java            |   3 +-
 .../GridDistributedTxPrepareRequest.java        |   2 +-
 .../GridDistributedTxPrepareResponse.java       |   3 +-
 .../dht/GridDhtAffinityAssignmentResponse.java  |   3 +-
 .../distributed/dht/GridDhtLockFuture.java      |  17 +-
 .../dht/GridDhtTxFinishResponse.java            |   3 +-
 .../cache/distributed/dht/GridDhtTxRemote.java  |  11 +-
 .../dht/preloader/GridDhtForceKeysResponse.java |   3 +-
 .../GridDhtPartitionDemandMessage.java          |   3 +-
 .../preloader/GridDhtPartitionsFullMessage.java |   5 +-
 .../GridDhtPartitionsSingleMessage.java         |   5 +-
 .../distributed/near/GridNearGetResponse.java   |   3 +-
 .../near/GridNearSingleGetResponse.java         |   3 +-
 .../near/GridNearTxFinishResponse.java          |   3 +-
 .../distributed/near/GridNearTxRemote.java      |   9 +-
 .../cache/query/GridCacheLocalQueryFuture.java  |   7 +-
 .../cache/query/GridCacheQueryRequest.java      |  13 +-
 .../cache/query/GridCacheQueryResponse.java     |   3 +-
 .../cache/query/GridCacheSqlQuery.java          |   6 +-
 .../CacheContinuousQueryBatchAck.java           |   4 +
 .../continuous/CacheContinuousQueryHandler.java |  12 +-
 .../cache/transactions/IgniteTxEntry.java       |   6 +-
 .../IgniteTxImplicitSingleStateImpl.java        |   5 +-
 .../transactions/IgniteTxLocalAdapter.java      |   4 +
 .../IgniteTxRemoteSingleStateImpl.java          |   6 +-
 .../version/GridCacheRawVersionedEntry.java     |   5 +-
 .../IgniteCacheObjectProcessorImpl.java         |   3 +-
 .../closure/GridClosureProcessor.java           |   6 +-
 .../continuous/GridContinuousProcessor.java     |   7 +-
 .../datastreamer/DataStreamProcessor.java       |   4 +-
 .../datastreamer/DataStreamerImpl.java          |  21 +--
 .../datastructures/GridCacheQueueAdapter.java   |  25 +++
 .../datastructures/GridCacheQueueProxy.java     |  14 +-
 .../datastructures/GridCacheSetImpl.java        |  38 ++++-
 .../datastructures/GridCacheSetProxy.java       |  14 +-
 .../processors/job/GridJobProcessor.java        |  10 +-
 .../internal/processors/job/GridJobWorker.java  |   2 +-
 .../offheap/GridOffHeapProcessor.java           |   2 +-
 .../handlers/task/GridTaskCommandHandler.java   |   6 +-
 .../service/GridServiceProcessor.java           |   3 +-
 .../processors/task/GridTaskProcessor.java      |   5 +-
 .../processors/task/GridTaskWorker.java         |   9 +-
 .../ignite/internal/util/GridHandleTable.java   |   7 +-
 .../ignite/internal/util/IgniteUtils.java       |  26 ++-
 .../OptimizedObjectStreamRegistry.java          | 145 ++++++++++-------
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  12 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  16 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   3 +-
 .../sharedfs/TcpDiscoverySharedFsIpFinder.java  |  35 +++-
 .../TcpDiscoveryCustomEventMessage.java         |   2 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  65 ++++++++
 .../cache/GridCacheAbstractSelfTest.java        |  19 +++
 .../IgniteCachePutStackOverflowSelfTest.java    | 133 +++++++++++++++
 .../GridCacheBinaryObjectsAbstractSelfTest.java |  40 +++++
 .../GridCacheQueueApiSelfAbstractTest.java      | 104 +++++++++++-
 .../GridCacheSetAbstractSelfTest.java           | 103 +++++++++++-
 .../GridCacheReplicatedPreloadSelfTest.java     | 163 +++++++++++++++++++
 .../internal/util/GridHandleTableSelfTest.java  |  50 ++++++
 .../OptimizedMarshallerPooledSelfTest.java      |  44 +++++
 .../TcpDiscoveryIpFinderAbstractSelfTest.java   |  15 +-
 .../testsuites/IgniteBinaryBasicTestSuite.java  |   4 +
 .../testsuites/IgniteCacheTestSuite5.java       |   2 +
 .../IgniteMarshallerSelfTestSuite.java          |   8 +-
 .../CacheDeploymentExternalizableTestValue.java |  69 ++++++++
 .../processors/query/h2/IgniteH2Indexing.java   |   4 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   2 +-
 87 files changed, 1387 insertions(+), 269 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9533cb25/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------


[25/51] [abbrv] ignite git commit: ignite-2523 : Fixed failing tests.

Posted by vo...@apache.org.
ignite-2523 : Fixed failing tests.


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

Branch: refs/heads/ignite-2523
Commit: 2f6aff8024794cd980fd77bb96e9a74876fb7442
Parents: 4f8220e
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Feb 9 15:04:52 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Tue Feb 9 15:04:52 2016 +0300

----------------------------------------------------------------------
 .../distributed/dht/atomic/GridDhtAtomicCache.java   | 15 +++++++++++----
 .../atomic/GridNearAtomicSingleUpdateRequest.java    |  2 ++
 .../atomic/GridNearAtomicSingleUpdateResponse.java   |  8 ++++----
 .../dht/atomic/GridNearAtomicUpdateFuture.java       |  6 +++---
 4 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2f6aff80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 05205e3..629aa25 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -269,6 +269,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicSingleUpdateResponse.class, new CI2<UUID, GridNearAtomicSingleUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicSingleUpdateResponse res) {
+                processNearAtomicUpdateResponse(nodeId, res);
+            }
+        });
+
         ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateRequest.class, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
             @Override public void apply(UUID nodeId, GridDhtAtomicUpdateRequest req) {
                 processDhtAtomicUpdateRequest(nodeId, req);
@@ -868,7 +874,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             TRANSFORM);
 
         return resFut.chain(new CX1<IgniteInternalFuture<Map<K, EntryProcessorResult<T>>>, Map<K, EntryProcessorResult<T>>>() {
-            @Override public Map<K, EntryProcessorResult<T>> applyx(IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut) throws IgniteCheckedException {
+            @Override public Map<K, EntryProcessorResult<T>> applyx(
+                IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut) throws IgniteCheckedException {
                 Map<Object, EntryProcessorResult> resMap = (Map)fut.get();
 
                 return ctx.unwrapInvokeResult(resMap, keepBinary);
@@ -1431,7 +1438,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             UpdateBatchResult updRes = updateWithBatch(node,
                                 hasNear,
                                 req,
-                                (GridNearAtomicMultipleUpdateResponse) res,
+                                (GridNearAtomicMultipleUpdateResponse)res,
                                 locked,
                                 ver,
                                 dhtFut,
@@ -2741,7 +2748,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param res Near atomic update response.
      */
     @SuppressWarnings("unchecked")
-    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
+    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponse res) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
 
@@ -2953,7 +2960,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) {
         try {
-            ctx.io().send(nodeId, (GridCacheMessage) res, ctx.ioPolicy());
+            ctx.io().send(nodeId, (GridCacheMessage)res, ctx.ioPolicy());
         }
         catch (ClusterTopologyCheckedException ignored) {
             U.warn(log, "Failed to send near update reply to node because it left grid: " +

http://git-wip-us.apache.org/repos/asf/ignite/blob/2f6aff80/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 1e981af..e69be07 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
@@ -213,6 +213,8 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         boolean clientReq,
         boolean addDepInfo
     ) {
+        System.out.println("???");
+
         assert futVer != null;
 
         this.key = key;

http://git-wip-us.apache.org/repos/asf/ignite/blob/2f6aff80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index 0bea0dd..65dc08e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -164,7 +164,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
         if (failed && key != null)
             return Collections.singletonList(key);
 
-        return Collections.emptyList();
+        return null;
     }
 
     /**
@@ -202,7 +202,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
         if (remap && key != null)
             return Collections.singletonList(key);
 
-        return Collections.emptyList();
+        return null;
     }
 
     /**
@@ -294,7 +294,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
         if (nearSkip && key != null)
             return Collections.singletonList(0);
 
-        return Collections.emptyList();
+        return null;
     }
 
     /**
@@ -304,7 +304,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
         if (hasNearVal && key != null)
             return Collections.singletonList(0);
 
-        return Collections.emptyList();
+        return null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/2f6aff80/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 55442dc..8edd0d4 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
@@ -339,7 +339,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param res Update response.
      */
-    public void onResult(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
+    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
         state.onResult(nodeId, res, false);
     }
 
@@ -454,9 +454,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
     private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicMultipleUpdateResponse>() {
+                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
                     @Override public void apply(GridNearAtomicUpdateRequest req,
-                        GridNearAtomicMultipleUpdateResponse res) {
+                        GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });


[29/51] [abbrv] ignite git commit: ignite-2523 : Removed unnecessary fields from GridDhtAtomicSingleUpdateRequest.

Posted by vo...@apache.org.
ignite-2523 : Removed unnecessary fields from GridDhtAtomicSingleUpdateRequest.


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

Branch: refs/heads/ignite-2523
Commit: cd07298f31be580b8341e0409b4669376e90f1bd
Parents: 3391c84
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Feb 9 17:46:37 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Tue Feb 9 17:46:37 2016 +0300

----------------------------------------------------------------------
 .../GridDhtAtomicSingleUpdateRequest.java       | 79 --------------------
 1 file changed, 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cd07298f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index c842270..0c0dd19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -112,69 +112,12 @@ public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implement
     @GridDirectTransient
     private CacheObject locPrevVal;
 
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Previous values. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> prevVals;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** TTLs. */
-    private GridLongList ttls;
-
-    /** Conflict expire time. */
-    private GridLongList conflictExpireTimes;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
     /** Write synchronization mode. */
     private CacheWriteSynchronizationMode syncMode;
 
-    /** Near cache keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearKeys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
     /** Force transform backups flag. */
     private boolean forceTransformBackups;
 
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Near entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
-
-    /** Near entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> nearEntryProcessorsBytes;
-
     /** Optional arguments for entry processor. */
     @GridDirectTransient
     private Object[] invokeArgs;
@@ -188,21 +131,10 @@ public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implement
     /** Task name hash. */
     private int taskNameHash;
 
-    /** Partition. */
-    private GridLongList updateCntrs;
-
     /** On response flag. Access should be synced on future. */
     @GridDirectTransient
     private boolean onRes;
 
-    /** */
-    @GridDirectTransient
-    private List<Integer> partIds;
-
-    /** */
-    @GridDirectTransient
-    private List<CacheObject> locPrevVals;
-
     /** Keep binary flag. */
     private boolean keepBinary;
 
@@ -256,17 +188,6 @@ public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implement
         this.invokeArgs = invokeArgs;
         this.addDepInfo = addDepInfo;
         this.keepBinary = keepBinary;
-
-        keys = new ArrayList<>();
-        partIds = new ArrayList<>();
-        locPrevVals = new ArrayList<>();
-
-        if (forceTransformBackups) {
-            entryProcessors = new ArrayList<>();
-            entryProcessorsBytes = new ArrayList<>();
-        }
-        else
-            vals = new ArrayList<>();
     }
 
     /**


[13/51] [abbrv] ignite git commit: IGNITE-2523: Renaming: interface -> base.

Posted by vo...@apache.org.
IGNITE-2523: Renaming: interface -> base.


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

Branch: refs/heads/ignite-2523
Commit: c54873bba2b2a0777a7ade33f5ec3da82c96ce95
Parents: 7e09a14
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 4 11:04:58 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 4 11:04:58 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          |  36 ++--
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |   8 +-
 .../GridNearAtomicSingleUpdateRequest.java      |   2 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  20 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |   2 +-
 .../atomic/GridNearAtomicUpdateRequestBase.java | 199 +++++++++++++++++++
 .../GridNearAtomicUpdateRequestInterface.java   | 199 -------------------
 .../distributed/near/GridNearAtomicCache.java   |   4 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   4 +-
 9 files changed, 237 insertions(+), 237 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index cdaa061..40494c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -139,7 +139,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Integer.getInteger(IGNITE_ATOMIC_DEFERRED_ACK_TIMEOUT, 500);
 
     /** Update reply closure. */
-    private CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> updateReplyClos;
+    private CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> updateReplyClos;
 
     /** Pending  */
     private ConcurrentMap<UUID, DeferredResponseBuffer> pendingResponses = new ConcurrentHashMap8<>();
@@ -192,9 +192,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        updateReplyClos = new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse>() {
+        updateReplyClos = new CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse>() {
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-            @Override public void apply(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponse res) {
+            @Override public void apply(GridNearAtomicUpdateRequestBase req, GridNearAtomicUpdateResponse res) {
                 if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
                     assert req.writeSynchronizationMode() != FULL_ASYNC : req;
 
@@ -1310,8 +1310,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal(
         final UUID nodeId,
-        final GridNearAtomicUpdateRequestInterface req,
-        final CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb
+        final GridNearAtomicUpdateRequestBase req,
+        final CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb
     ) {
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
@@ -1335,8 +1335,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal0(
         UUID nodeId,
-        GridNearAtomicUpdateRequestInterface req,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb
+        GridNearAtomicUpdateRequestBase req,
+        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb
     ) {
         GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
             ctx.deploymentEnabled());
@@ -1558,12 +1558,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateBatchResult updateWithBatch(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateRequestBase req,
         GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -1974,12 +1974,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateSingleResult updateSingle(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateRequestBase req,
         GridNearAtomicUpdateResponse res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2214,8 +2214,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable Collection<KeyCacheObject> rmvKeys,
         @Nullable Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb,
-        final GridNearAtomicUpdateRequestInterface req,
+        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
+        final GridNearAtomicUpdateRequestBase req,
         final GridNearAtomicUpdateResponse res,
         boolean replicate,
         UpdateBatchResult batchRes,
@@ -2593,7 +2593,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      *      will return false.
      * @return {@code True} if filter evaluation succeeded.
      */
-    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequestInterface req,
+    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequestBase req,
         GridNearAtomicUpdateResponse res) {
         try {
             return ctx.isAllLocked(entry, req.filter());
@@ -2608,7 +2608,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /**
      * @param req Request to remap.
      */
-    private void remapToNewPrimary(GridNearAtomicUpdateRequestInterface req) {
+    private void remapToNewPrimary(GridNearAtomicUpdateRequestBase req) {
         assert req.writeSynchronizationMode() == FULL_ASYNC : req;
 
         if (log.isDebugEnabled())
@@ -2687,9 +2687,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequestInterface updateReq,
+        GridNearAtomicUpdateRequestBase updateReq,
         GridNearAtomicUpdateResponse updateRes,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
         boolean force
     ) {
         if (!force) {
@@ -2720,7 +2720,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Sender node ID.
      * @param req Near atomic update request.
      */
-    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
+    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequestBase req) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index df6b048..7820832 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -77,7 +77,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
 
     /** Completion callback. */
     @GridToStringExclude
-    private final CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb;
+    private final CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb;
 
     /** Mappings. */
     @GridToStringInclude
@@ -87,7 +87,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
     private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
 
     /** Update request. */
-    private final GridNearAtomicUpdateRequestInterface updateReq;
+    private final GridNearAtomicUpdateRequestBase updateReq;
 
     /** Update response. */
     private final GridNearAtomicUpdateResponse updateRes;
@@ -110,9 +110,9 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public GridDhtAtomicUpdateFuture(
         GridCacheContext cctx,
-        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse> completionCb,
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequestInterface updateReq,
+        GridNearAtomicUpdateRequestBase updateReq,
         GridNearAtomicUpdateResponse updateRes
     ) {
         this.cctx = cctx;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/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 fea67c0..1c30482 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
@@ -57,7 +57,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequestBase, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/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 149d277..f894551 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
@@ -348,7 +348,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param req Update request.
      * @param res Update response.
      */
-    private void updateNear(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponse res) {
+    private void updateNear(GridNearAtomicUpdateRequestBase req, GridNearAtomicUpdateResponse res) {
         assert nearEnabled;
 
         if (res.remapKeys() != null || !req.hasPrimary())
@@ -450,11 +450,11 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param req Request.
      */
-    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
+    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequestBase req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequestInterface req,
+                new CI2<GridNearAtomicUpdateRequestBase, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicUpdateRequestBase req,
                         GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
@@ -559,7 +559,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         private Collection<KeyCacheObject> remapKeys;
 
         /** Not null is operation is mapped to single node. */
-        private GridNearAtomicUpdateRequestInterface singleReq;
+        private GridNearAtomicUpdateRequestBase singleReq;
 
         /** Operation result. */
         private GridCacheReturn opRes;
@@ -578,7 +578,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             GridNearAtomicUpdateResponse res = null;
 
             synchronized (this) {
-                GridNearAtomicUpdateRequestInterface req;
+                GridNearAtomicUpdateRequestBase req;
 
                 if (singleReq != null)
                     req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
@@ -611,7 +611,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          */
         @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
         void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
-            GridNearAtomicUpdateRequestInterface req;
+            GridNearAtomicUpdateRequestBase req;
 
             AffinityTopologyVersion remapTopVer = null;
 
@@ -815,7 +815,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param req Request.
          * @param e Error.
          */
-        void onSendError(GridNearAtomicUpdateRequestInterface req, IgniteCheckedException e) {
+        void onSendError(GridNearAtomicUpdateRequestBase req, IgniteCheckedException e) {
             synchronized (this) {
                 GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
                     req.nodeId(),
@@ -843,7 +843,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             }
 
             Exception err = null;
-            GridNearAtomicUpdateRequestInterface singleReq0 = null;
+            GridNearAtomicUpdateRequestBase singleReq0 = null;
             Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
 
             int size = keys.size();
@@ -1128,7 +1128,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @return Request.
          * @throws Exception If failed.
          */
-        private GridNearAtomicUpdateRequestInterface mapSingleUpdate(AffinityTopologyVersion topVer,
+        private GridNearAtomicUpdateRequestBase mapSingleUpdate(AffinityTopologyVersion topVer,
             Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer)
             throws Exception {
             Object key = F.first(keys);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index a86622f..08b29be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -58,7 +58,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequestBase, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java
new file mode 100644
index 0000000..8ddb181
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.jetbrains.annotations.Nullable;
+
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Base interface for near atomic update requests.
+ */
+public interface GridNearAtomicUpdateRequestBase {
+    /**
+     * @return Message ID.
+     */
+    public long messageId();
+
+    /**
+     * @return Mapped node ID.
+     */
+    public UUID nodeId();
+
+    /**
+     * @param nodeId Node ID.
+     */
+    public void nodeId(UUID nodeId);
+
+    /**
+     * @return Subject ID.
+     */
+    public UUID subjectId();
+
+    /**
+     * @return Task name hash.
+     */
+    public int taskNameHash();
+
+    /**
+     * @return Future version.
+     */
+    public GridCacheVersion futureVersion();
+
+    /**
+     * @return Flag indicating whether this is fast-map udpate.
+     */
+    public boolean fastMap();
+
+    /**
+     * @return Update version for fast-map request.
+     */
+    public GridCacheVersion updateVersion();
+
+    /**
+     * @return Topology version.
+     */
+    public AffinityTopologyVersion topologyVersion();
+
+    /**
+     * @return Topology locked flag.
+     */
+    public boolean topologyLocked();
+
+    /**
+     * @return {@code True} if request sent from client node.
+     */
+    public boolean clientRequest();
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    public CacheWriteSynchronizationMode writeSynchronizationMode();
+
+    /**
+     * @return Expiry policy.
+     */
+    public ExpiryPolicy expiry();
+
+    /**
+     * @return Return value flag.
+     */
+    public boolean returnValue();
+
+    /**
+     * @return Filter.
+     */
+    @Nullable public CacheEntryPredicate[] filter();
+
+    /**
+     * @return Skip write-through to a persistent storage.
+     */
+    public boolean skipStore();
+
+    /**
+     * @return Keep binary flag.
+     */
+    public boolean keepBinary();
+
+    /**
+     * @return Keys for this update request.
+     */
+    public List<KeyCacheObject> keys();
+
+    /**
+     * @return Values for this update request.
+     */
+    public List<?> values();
+
+    /**
+     * @return Update operation.
+     */
+    public GridCacheOperation operation();
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable public Object[] invokeArguments();
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    public CacheObject value(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+    /**
+     * @param idx Index to get.
+     * @return Write value - either value, or transform closure.
+     */
+    public CacheObject writeValue(int idx);
+
+    /**
+     * @return Conflict versions.
+     */
+    @Nullable public List<GridCacheVersion> conflictVersions();
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Nullable public GridCacheVersion conflictVersion(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict TTL.
+     */
+    public long conflictTtl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    public long conflictExpireTime(int idx);
+
+    /**
+     * @return Flag indicating whether this request contains primary keys.
+     */
+    public boolean hasPrimary();
+
+    /**
+     * @param res Response.
+     * @return {@code True} if current response was {@code null}.
+     */
+    public boolean onResponse(GridNearAtomicUpdateResponse res);
+
+    /**
+     * @return Response.
+     */
+    @Nullable public GridNearAtomicUpdateResponse response();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
deleted file mode 100644
index 8115f9f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Base interface for near atomic update interfaces.
- */
-public interface GridNearAtomicUpdateRequestInterface {
-    /**
-     * @return Message ID.
-     */
-    public long messageId();
-
-    /**
-     * @return Mapped node ID.
-     */
-    public UUID nodeId();
-
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId);
-
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId();
-
-    /**
-     * @return Task name hash.
-     */
-    public int taskNameHash();
-
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion();
-
-    /**
-     * @return Flag indicating whether this is fast-map udpate.
-     */
-    public boolean fastMap();
-
-    /**
-     * @return Update version for fast-map request.
-     */
-    public GridCacheVersion updateVersion();
-
-    /**
-     * @return Topology version.
-     */
-    public AffinityTopologyVersion topologyVersion();
-
-    /**
-     * @return Topology locked flag.
-     */
-    public boolean topologyLocked();
-
-    /**
-     * @return {@code True} if request sent from client node.
-     */
-    public boolean clientRequest();
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode();
-
-    /**
-     * @return Expiry policy.
-     */
-    public ExpiryPolicy expiry();
-
-    /**
-     * @return Return value flag.
-     */
-    public boolean returnValue();
-
-    /**
-     * @return Filter.
-     */
-    @Nullable public CacheEntryPredicate[] filter();
-
-    /**
-     * @return Skip write-through to a persistent storage.
-     */
-    public boolean skipStore();
-
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary();
-
-    /**
-     * @return Keys for this update request.
-     */
-    public List<KeyCacheObject> keys();
-
-    /**
-     * @return Values for this update request.
-     */
-    public List<?> values();
-
-    /**
-     * @return Update operation.
-     */
-    public GridCacheOperation operation();
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments();
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    public CacheObject value(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
-
-    /**
-     * @param idx Index to get.
-     * @return Write value - either value, or transform closure.
-     */
-    public CacheObject writeValue(int idx);
-
-    /**
-     * @return Conflict versions.
-     */
-    @Nullable public List<GridCacheVersion> conflictVersions();
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict TTL.
-     */
-    public long conflictTtl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx);
-
-    /**
-     * @return Flag indicating whether this request contains primary keys.
-     */
-    public boolean hasPrimary();
-
-    /**
-     * @param res Response.
-     * @return {@code True} if current response was {@code null}.
-     */
-    public boolean onResponse(GridNearAtomicUpdateResponse res);
-
-    /**
-     * @return Response.
-     */
-    @Nullable public GridNearAtomicUpdateResponse response();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 2a91968..22b9504 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -45,7 +45,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvali
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestBase;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
@@ -127,7 +127,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      * @param res Update response.
      */
     public void processNearAtomicUpdateResponse(
-        GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateRequestBase req,
         GridNearAtomicUpdateResponse res
     ) {
         if (F.size(res.failedKeys()) == req.keys().size())

http://git-wip-us.apache.org/repos/asf/ignite/blob/c54873bb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index c83af51..18ff8df 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -63,7 +63,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestBase;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -412,7 +412,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         assertEquals(3, msgs.size());
 
         for (Object msg : msgs)
-            assertTrue(((GridNearAtomicUpdateRequestInterface)msg).clientRequest());
+            assertTrue(((GridNearAtomicUpdateRequestBase)msg).clientRequest());
 
         map.put(primaryKey(ignite0.cache(null)), 3);
         map.put(primaryKey(ignite1.cache(null)), 4);


[43/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
new file mode 100644
index 0000000..74cdc6e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ * DHT atomic cache backup update response.
+ */
+public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> failedKeys;
+
+    /** Update error. */
+    @GridDirectTransient
+    private IgniteCheckedException err;
+
+    /** Serialized update error. */
+    private byte[] errBytes;
+
+    /** Evicted readers. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearEvicted;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
+        this.cacheId = cacheId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Future version.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    @Override public void onError(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /**
+     * @return Failed keys.
+     */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * @return Evicted readers.
+     */
+    @Override public Collection<KeyCacheObject> nearEvicted() {
+        return nearEvicted;
+    }
+
+    /**
+     * Adds near evicted key..
+     *
+     * @param key Evicted key.
+     */
+    @Override public void addNearEvicted(KeyCacheObject key) {
+        if (nearEvicted == null)
+            nearEvicted = new ArrayList<>();
+
+        nearEvicted.add(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(nearEvicted, cctx);
+
+        if (errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 39;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 7;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicUpdateResponse.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
deleted file mode 100644
index d1c3654..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
-
-/**
- * Lite DHT cache update request sent from near node to primary node.
- */
-public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Target node ID. */
-    @GridDirectTransient
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Fast map flag. */
-    private boolean fastMap;
-
-    /** Update version. Set to non-null if fastMap is {@code true}. */
-    private GridCacheVersion updateVer;
-
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
-    /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
-    private boolean topLocked;
-
-    /** Write synchronization mode. */
-    private CacheWriteSynchronizationMode syncMode;
-
-    /** Update operation. */
-    private GridCacheOperation op;
-
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Optional arguments for entry processor. */
-    @GridDirectTransient
-    private Object[] invokeArgs;
-
-    /** Entry processor arguments bytes. */
-    private byte[][] invokeArgsBytes;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** Conflict TTLs. */
-    private GridLongList conflictTtls;
-
-    /** Conflict expire times. */
-    private GridLongList conflictExpireTimes;
-
-    /** Return value flag. */
-    private boolean retval;
-
-    /** Expiry policy. */
-    @GridDirectTransient
-    private ExpiryPolicy expiryPlc;
-
-    /** Expiry policy bytes. */
-    private byte[] expiryPlcBytes;
-
-    /** Filter. */
-    private CacheEntryPredicate[] filter;
-
-    /** Flag indicating whether request contains primary keys. */
-    private boolean hasPrimary;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /** Task name hash. */
-    private int taskNameHash;
-
-    /** Skip write-through to a persistent storage. */
-    private boolean skipStore;
-
-    /** */
-    private boolean clientReq;
-
-    /** Keep binary flag. */
-    private boolean keepBinary;
-
-    /** */
-    @GridDirectTransient
-    private GridNearAtomicUpdateResponseInterface res;
-
-    /** Maximum possible size of inner collections. */
-    @GridDirectTransient
-    private int initSize;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridNearAtomicMultipleUpdateRequest() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID.
-     * @param futVer Future version.
-     * @param fastMap Fast map scheme flag.
-     * @param updateVer Update version set if fast map is performed.
-     * @param topVer Topology version.
-     * @param topLocked Topology locked flag.
-     * @param syncMode Synchronization mode.
-     * @param op Cache update operation.
-     * @param retval Return value required flag.
-     * @param expiryPlc Expiry policy.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param filter Optional filter for atomic check.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param skipStore Skip write-through to a persistent storage.
-     * @param keepBinary Keep binary flag.
-     * @param clientReq Client node request flag.
-     * @param addDepInfo Deployment info flag.
-     * @param maxEntryCnt Maximum entries count.
-     */
-    public GridNearAtomicMultipleUpdateRequest(
-        int cacheId,
-        UUID nodeId,
-        GridCacheVersion futVer,
-        boolean fastMap,
-        @Nullable GridCacheVersion updateVer,
-        @NotNull AffinityTopologyVersion topVer,
-        boolean topLocked,
-        CacheWriteSynchronizationMode syncMode,
-        GridCacheOperation op,
-        boolean retval,
-        @Nullable ExpiryPolicy expiryPlc,
-        @Nullable Object[] invokeArgs,
-        @Nullable CacheEntryPredicate[] filter,
-        @Nullable UUID subjId,
-        int taskNameHash,
-        boolean skipStore,
-        boolean keepBinary,
-        boolean clientReq,
-        boolean addDepInfo,
-        int maxEntryCnt
-    ) {
-        assert futVer != null;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.fastMap = fastMap;
-        this.updateVer = updateVer;
-
-        this.topVer = topVer;
-        this.topLocked = topLocked;
-        this.syncMode = syncMode;
-        this.op = op;
-        this.retval = retval;
-        this.expiryPlc = expiryPlc;
-        this.invokeArgs = invokeArgs;
-        this.filter = filter;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.skipStore = skipStore;
-        this.keepBinary = keepBinary;
-        this.clientReq = clientReq;
-        this.addDepInfo = addDepInfo;
-
-        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
-        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
-        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
-        // than 10, we use it.
-        initSize = Math.min(maxEntryCnt, 10);
-
-        keys = new ArrayList<>(initSize);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void nodeId(UUID nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID subjectId() {
-        return subjId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int taskNameHash() {
-        return taskNameHash;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean fastMap() {
-        return fastMap;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion updateVersion() {
-        return updateVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return topVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean topologyLocked() {
-        return topLocked;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clientRequest() {
-        return clientReq;
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return syncMode;
-    }
-
-    /** {@inheritDoc} */
-    @Override public ExpiryPolicy expiry() {
-        return expiryPlc;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean returnValue() {
-        return retval;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable public CacheEntryPredicate[] filter() {
-        return filter;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean skipStore() {
-        return skipStore;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean keepBinary() {
-        return keepBinary;
-    }
-
-    /**
-     * @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).
-     * @param primary If given key is primary on this mapping.
-     */
-    @SuppressWarnings("unchecked")
-    public void addUpdateEntry(KeyCacheObject key,
-        @Nullable Object val,
-        long conflictTtl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean primary) {
-        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;
-
-        keys.add(key);
-
-        if (entryProcessor != null) {
-            if (entryProcessors == null)
-                entryProcessors = new ArrayList<>(initSize);
-
-            entryProcessors.add(entryProcessor);
-        }
-        else if (val != null) {
-            assert val instanceof CacheObject : val;
-
-            if (vals == null)
-                vals = new ArrayList<>(initSize);
-
-            vals.add((CacheObject)val);
-        }
-
-        hasPrimary |= primary;
-
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>(initSize);
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (conflictTtl >= 0) {
-            if (conflictTtls == null) {
-                conflictTtls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictTtls.add(CU.TTL_NOT_CHANGED);
-            }
-
-            conflictTtls.add(conflictTtl);
-        }
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-
-            conflictExpireTimes.add(conflictExpireTime);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<KeyCacheObject> keys() {
-        return keys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<?> values() {
-        return op == TRANSFORM ? entryProcessors : vals;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheOperation operation() {
-        return op;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public Object[] invokeArguments() {
-        return invokeArgs;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public CacheObject value(int idx) {
-        assert op == UPDATE : op;
-
-        return vals.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
-        assert op == TRANSFORM : op;
-
-        return entryProcessors.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheObject writeValue(int idx) {
-        if (vals != null)
-            return vals.get(idx);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
-        return conflictVers;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictTtl(int idx) {
-        if (conflictTtls != null) {
-            assert idx >= 0 && idx < conflictTtls.size();
-
-            return conflictTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
-
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean hasPrimary() {
-        return hasPrimary;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
-        if (this.res == null) {
-            this.res = res;
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(keys, cctx);
-
-        if (filter != null) {
-            boolean hasFilter = false;
-
-            for (CacheEntryPredicate p : filter) {
-                if (p != null) {
-                    hasFilter = true;
-
-                    p.prepareMarshal(cctx);
-                }
-            }
-
-            if (!hasFilter)
-                filter = null;
-        }
-
-        if (expiryPlc != null && expiryPlcBytes == null)
-            expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
-
-        if (op == TRANSFORM) {
-            // force addition of deployment info for entry processors if P2P is enabled globally.
-            if (!addDepInfo && ctx.deploymentEnabled())
-                addDepInfo = true;
-
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
-            if (invokeArgsBytes == null)
-                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
-        }
-        else
-            prepareMarshalCacheObjects(vals, cctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
-
-        if (op == TRANSFORM) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
-            if (invokeArgs == null)
-                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
-        }
-        else
-            finishUnmarshalCacheObjects(vals, cctx, ldr);
-
-        if (filter != null) {
-            for (CacheEntryPredicate p : filter) {
-                if (p != null)
-                    p.finishUnmarshal(cctx, ldr);
-            }
-        }
-
-        if (expiryPlcBytes != null && expiryPlc == null)
-            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeBoolean("clientReq", clientReq))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("conflictTtls", conflictTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeBoolean("fastMap", fastMap))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeBoolean("hasPrimary", hasPrimary))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 14:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
-                    return false;
-
-                writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
-                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 17:
-                if (!writer.writeBoolean("retval", retval))
-                    return false;
-
-                writer.incrementState();
-
-            case 18:
-                if (!writer.writeBoolean("skipStore", skipStore))
-                    return false;
-
-                writer.incrementState();
-
-            case 19:
-                if (!writer.writeUuid("subjId", subjId))
-                    return false;
-
-                writer.incrementState();
-
-            case 20:
-                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 21:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
-                    return false;
-
-                writer.incrementState();
-
-            case 22:
-                if (!writer.writeBoolean("topLocked", topLocked))
-                    return false;
-
-                writer.incrementState();
-
-            case 23:
-                if (!writer.writeMessage("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 24:
-                if (!writer.writeMessage("updateVer", updateVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 25:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                clientReq = reader.readBoolean("clientReq");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                conflictTtls = reader.readMessage("conflictTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                fastMap = reader.readBoolean("fastMap");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                hasPrimary = reader.readBoolean("hasPrimary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 14:
-                keepBinary = reader.readBoolean("keepBinary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 15:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 16:
-                byte opOrd;
-
-                opOrd = reader.readByte("op");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                op = GridCacheOperation.fromOrdinal(opOrd);
-
-                reader.incrementState();
-
-            case 17:
-                retval = reader.readBoolean("retval");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 18:
-                skipStore = reader.readBoolean("skipStore");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 19:
-                subjId = reader.readUuid("subjId");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 20:
-                byte syncModeOrd;
-
-                syncModeOrd = reader.readByte("syncMode");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
-
-                reader.incrementState();
-
-            case 21:
-                taskNameHash = reader.readInt("taskNameHash");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 22:
-                topLocked = reader.readBoolean("topLocked");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 23:
-                topVer = reader.readMessage("topVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 24:
-                updateVer = reader.readMessage("updateVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 25:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridNearAtomicMultipleUpdateRequest.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void cleanup(boolean clearKeys) {
-        vals = null;
-        entryProcessors = null;
-        entryProcessorsBytes = null;
-        invokeArgs = null;
-        invokeArgsBytes = null;
-
-        if (clearKeys)
-            keys = null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 40;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 26;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearAtomicMultipleUpdateRequest.class, this, "filter", Arrays.toString(filter),
-            "parent", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
deleted file mode 100644
index 24e7c3a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
+++ /dev/null
@@ -1,642 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheReturn;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * DHT atomic cache near update response.
- */
-public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Cache message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Node ID this reply should be sent to. */
-    @GridDirectTransient
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Update error. */
-    @GridDirectTransient
-    private volatile IgniteCheckedException err;
-
-    /** Serialized error. */
-    private byte[] errBytes;
-
-    /** Return value. */
-    @GridToStringInclude
-    private GridCacheReturn ret;
-
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private volatile Collection<KeyCacheObject> failedKeys;
-
-    /** Keys that should be remapped. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> remapKeys;
-
-    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearValsIdxs;
-
-    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearSkipIdxs;
-
-    /** Values generated on primary node which should be put to originating node's near cache. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
-    /** Version generated on primary node to be used for originating node's near cache update. */
-    private GridCacheVersion nearVer;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridNearAtomicMultipleUpdateResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID this reply should be sent to.
-     * @param futVer Future version.
-     * @param addDepInfo Deployment info flag.
-     */
-    public GridNearAtomicMultipleUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
-        assert futVer != null;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.addDepInfo = addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /**
-     * @return Node ID this response should be sent to.
-     */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /**
-     * @param nodeId Node ID.
-     */
-    @Override public void nodeId(UUID nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    /**
-     * @return Future version.
-     */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    @Override public void error(IgniteCheckedException err) {
-        this.err = err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteCheckedException error() {
-        return err;
-    }
-
-    /**
-     * @return Collection of failed keys.
-     */
-    @Override public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
-    }
-
-    /**
-     * @return Return value.
-     */
-    @Override public GridCacheReturn returnValue() {
-        return ret;
-    }
-
-    /**
-     * @param ret Return value.
-     */
-    @Override @SuppressWarnings("unchecked")
-    public void returnValue(GridCacheReturn ret) {
-        this.ret = ret;
-    }
-
-    /**
-     * @param remapKeys Remap keys.
-     */
-    @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
-        this.remapKeys = remapKeys;
-    }
-
-    /**
-     * @return Remap keys.
-     */
-    @Override public Collection<KeyCacheObject> remapKeys() {
-        return remapKeys;
-    }
-
-    /**
-     * Adds value to be put in near cache on originating node.
-     *
-     * @param keyIdx Key index.
-     * @param val Value.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    @Override public void addNearValue(int keyIdx,
-        @Nullable CacheObject val,
-        long ttl,
-        long expireTime) {
-        if (nearValsIdxs == null) {
-            nearValsIdxs = new ArrayList<>();
-            nearVals = new ArrayList<>();
-        }
-
-        addNearTtl(keyIdx, ttl, expireTime);
-
-        nearValsIdxs.add(keyIdx);
-        nearVals.add(val);
-    }
-
-    /**
-     * @param keyIdx Key index.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    @Override @SuppressWarnings("ForLoopReplaceableByForEach")
-    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearTtls.add(-1L);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
-
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearExpireTimes.add(-1);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
-    }
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    @Override public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
-
-        return -1L;
-    }
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    @Override public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
-
-        return -1L;
-    }
-
-    /**
-     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
-     */
-    @Override public void nearVersion(GridCacheVersion nearVer) {
-        this.nearVer = nearVer;
-    }
-
-    /**
-     * @return Version generated on primary node to be used for originating node's near cache update.
-     */
-    @Override public GridCacheVersion nearVersion() {
-        return nearVer;
-    }
-
-    /**
-     * @param keyIdx Index of key for which update was skipped
-     */
-    @Override public void addSkippedIndex(int keyIdx) {
-        if (nearSkipIdxs == null)
-            nearSkipIdxs = new ArrayList<>();
-
-        nearSkipIdxs.add(keyIdx);
-
-        addNearTtl(keyIdx, -1L, -1L);
-    }
-
-    /**
-     * @return Indexes of keys for which update was skipped
-     */
-    @Override @Nullable public List<Integer> skippedIndexes() {
-        return nearSkipIdxs;
-    }
-
-    /**
-     * @return Indexes of keys for which values were generated on primary node.
-     */
-    @Override @Nullable public List<Integer> nearValuesIndexes() {
-        return nearValsIdxs;
-    }
-
-    /**
-     * @param idx Index.
-     * @return Value generated on primary node which should be put to originating node's near cache.
-     */
-    @Override @Nullable public CacheObject nearValue(int idx) {
-        return nearVals.get(idx);
-    }
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ConcurrentLinkedQueue<>();
-
-        failedKeys.add(key);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     */
-    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
-        if (keys != null) {
-            if (failedKeys == null)
-                failedKeys = new ArrayList<>(keys.size());
-
-            failedKeys.addAll(keys);
-        }
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     * @param ctx Context.
-     */
-    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
-        GridCacheContext ctx) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>(keys.size());
-
-        failedKeys.addAll(keys);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /** {@inheritDoc}
-     * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        if (err != null && errBytes == null)
-            errBytes = ctx.marshaller().marshal(err);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(failedKeys, cctx);
-
-        prepareMarshalCacheObjects(remapKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
-
-        if (ret != null)
-            ret.prepareMarshal(cctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
-
-        if (ret != null)
-            ret.finishUnmarshal(cctx, ldr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeByteArray("errBytes", errBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeMessage("nearTtls", nearTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeMessage("nearVer", nearVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeMessage("ret", ret))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                errBytes = reader.readByteArray("errBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                nearTtls = reader.readMessage("nearTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                nearVer = reader.readMessage("nearVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                ret = reader.readMessage("ret");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridNearAtomicMultipleUpdateResponse.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 41;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 14;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearAtomicMultipleUpdateResponse.class, this, "parent");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/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 de89d91..7e6dc20 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
@@ -482,13 +482,13 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      *
      * @param mappings Mappings to send.
      */
-    private void doUpdate(Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings) {
+    private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
         UUID locNodeId = cctx.localNodeId();
 
-        GridNearAtomicMultipleUpdateRequest locUpdate = null;
+        GridNearAtomicUpdateRequest locUpdate = null;
 
         // Send messages to remote nodes first, then run local update.
-        for (GridNearAtomicMultipleUpdateRequest req : mappings.values()) {
+        for (GridNearAtomicUpdateRequest req : mappings.values()) {
             if (locNodeId.equals(req.nodeId())) {
                 assert locUpdate == null : "Cannot have more than one local mapping [locUpdate=" + locUpdate +
                     ", req=" + req + ']';
@@ -537,7 +537,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         /** Mappings if operations is mapped to more than one node. */
         @GridToStringInclude
-        private Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings;
+        private Map<UUID, GridNearAtomicUpdateRequest> mappings;
 
         /** */
         private int resCnt;
@@ -588,7 +588,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                             req.futureVersion(),
                             cctx.deploymentEnabled());
                     else
-                        res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
+                        res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
                             nodeId,
                             req.futureVersion(),
                             cctx.deploymentEnabled());
@@ -743,7 +743,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
-                    for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
+                    for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
                         GridNearAtomicUpdateResponseInterface res0 = req0.response();
 
                         assert res0 != null : req0;
@@ -827,7 +827,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                         req.futureVersion(),
                         cctx.deploymentEnabled());
                 else
-                    res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
+                    res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
                         req.nodeId(),
                         req.futureVersion(),
                         cctx.deploymentEnabled());
@@ -854,7 +854,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
             Exception err = null;
             GridNearAtomicUpdateRequestInterface singleReq0 = null;
-            Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings0 = null;
+            Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
 
             int size = keys.size();
 
@@ -883,7 +883,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     singleReq0 = mapSingleUpdate(topVer, topNodes, futVer, updVer);
                 }
                 else {
-                    Map<UUID, GridNearAtomicMultipleUpdateRequest> pendingMappings = mapUpdate(topNodes,
+                    Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
                         topVer,
                         futVer,
                         updVer,
@@ -895,7 +895,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                         if (syncMode == PRIMARY_SYNC) {
                             mappings0 = U.newHashMap(pendingMappings.size());
 
-                            for (GridNearAtomicMultipleUpdateRequest req : pendingMappings.values()) {
+                            for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
                                 if (req.hasPrimary())
                                     mappings0.put(req.nodeId(), req);
                             }
@@ -1006,7 +1006,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @throws Exception If failed.
          */
         @SuppressWarnings("ConstantConditions")
-        private Map<UUID, GridNearAtomicMultipleUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+        private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
             AffinityTopologyVersion topVer,
             GridCacheVersion futVer,
             @Nullable GridCacheVersion updVer,
@@ -1026,7 +1026,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (conflictRmvVals != null)
                 conflictRmvValsIt = conflictRmvVals.iterator();
 
-            Map<UUID, GridNearAtomicMultipleUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+            Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
 
             // Create mappings first, then send messages.
             for (Object key : keys) {
@@ -1094,10 +1094,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
                     UUID nodeId = affNode.id();
 
-                    GridNearAtomicMultipleUpdateRequest mapped = pendingMappings.get(nodeId);
+                    GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
 
                     if (mapped == null) {
-                        mapped = new GridNearAtomicMultipleUpdateRequest(
+                        mapped = new GridNearAtomicUpdateRequest(
                             cctx.cacheId(),
                             nodeId,
                             futVer,
@@ -1238,7 +1238,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     cctx.deploymentEnabled());
             }
             else {
-                GridNearAtomicMultipleUpdateRequest req = new GridNearAtomicMultipleUpdateRequest(
+                GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
                     cctx.cacheId(),
                     primary.id(),
                     futVer,


[14/51] [abbrv] ignite git commit: IGNITE-2523: Fixing tests.

Posted by vo...@apache.org.
IGNITE-2523: Fixing tests.


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

Branch: refs/heads/ignite-2523
Commit: e83408060970aba8f3f98ec7be1d96bab4fa888c
Parents: c54873b
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 4 12:05:56 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 4 12:05:56 2016 +0300

----------------------------------------------------------------------
 ...niteCacheClientNodeChangingTopologyTest.java | 29 ++++++++++++++++----
 1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e8340806/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 18ff8df..8182b33 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -108,6 +108,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
 /**
  *
  */
+@SuppressWarnings({"unchecked", "unused", "NullArgumentToVariableArgMethod", "ConstantConditions", "UnusedAssignment"})
 public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstractTest {
     /** */
     protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
@@ -374,8 +375,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite2.localNode().id());
 
-        spi.record(GridNearAtomicUpdateRequest.class);
-        spi.record(GridNearAtomicSingleUpdateRequest.class);
+        spi.record(GridNearAtomicUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
 
         final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
 
@@ -2019,7 +2019,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         private Map<Class<?>, Set<UUID>> blockCls = new HashMap<>();
 
         /** */
-        private Class<?> recordCls;
+        private Class<?>[] recordClss;
 
         /** */
         private List<Object> recordedMsgs = new ArrayList<>();
@@ -2031,7 +2031,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
                 Object msg0 = ((GridIoMessage)msg).message();
 
                 synchronized (this) {
-                    if (recordCls != null && msg0.getClass().equals(recordCls))
+                    if (isRecordMessage(msg0.getClass()))
                         recordedMsgs.add(msg0);
 
                     Set<UUID> blockNodes = blockCls.get(msg0.getClass());
@@ -2053,9 +2053,9 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         /**
          * @param recordCls Message class to record.
          */
-        void record(@Nullable Class<?> recordCls) {
+        void record(@Nullable Class... recordCls) {
             synchronized (this) {
-                this.recordCls = recordCls;
+                this.recordClss = recordCls;
             }
         }
 
@@ -2109,6 +2109,23 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
                 blockedMsgs.clear();
             }
         }
+
+        /**
+         * Decide whether to record message or not.
+         *
+         * @param msgCls Message class.
+         * @return {@code True} if message should be recorded.
+         */
+        private boolean isRecordMessage(Class msgCls) {
+            if (recordClss != null) {
+                for (Class recordCls : recordClss) {
+                    if (msgCls.equals(recordCls))
+                        return true;
+                }
+            }
+
+            return false;
+        }
     }
 
     /**


[42/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
new file mode 100644
index 0000000..60193ba
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -0,0 +1,989 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+
+/**
+ * Lite DHT cache update request sent from near node to primary node.
+ */
+public class GridNearAtomicUpdateRequest extends GridCacheMessage
+    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Target node ID. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Fast map flag. */
+    private boolean fastMap;
+
+    /** Update version. Set to non-null if fastMap is {@code true}. */
+    private GridCacheVersion updateVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+    private boolean topLocked;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Update operation. */
+    private GridCacheOperation op;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** Conflict TTLs. */
+    private GridLongList conflictTtls;
+
+    /** Conflict expire times. */
+    private GridLongList conflictExpireTimes;
+
+    /** Return value flag. */
+    private boolean retval;
+
+    /** Expiry policy. */
+    @GridDirectTransient
+    private ExpiryPolicy expiryPlc;
+
+    /** Expiry policy bytes. */
+    private byte[] expiryPlcBytes;
+
+    /** Filter. */
+    private CacheEntryPredicate[] filter;
+
+    /** Flag indicating whether request contains primary keys. */
+    private boolean hasPrimary;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Skip write-through to a persistent storage. */
+    private boolean skipStore;
+
+    /** */
+    private boolean clientReq;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /** */
+    @GridDirectTransient
+    private GridNearAtomicUpdateResponseInterface res;
+
+    /** Maximum possible size of inner collections. */
+    @GridDirectTransient
+    private int initSize;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param fastMap Fast map scheme flag.
+     * @param updateVer Update version set if fast map is performed.
+     * @param topVer Topology version.
+     * @param topLocked Topology locked flag.
+     * @param syncMode Synchronization mode.
+     * @param op Cache update operation.
+     * @param retval Return value required flag.
+     * @param expiryPlc Expiry policy.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param filter Optional filter for atomic check.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param skipStore Skip write-through to a persistent storage.
+     * @param keepBinary Keep binary flag.
+     * @param clientReq Client node request flag.
+     * @param addDepInfo Deployment info flag.
+     * @param maxEntryCnt Maximum entries count.
+     */
+    public GridNearAtomicUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        boolean fastMap,
+        @Nullable GridCacheVersion updateVer,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean topLocked,
+        CacheWriteSynchronizationMode syncMode,
+        GridCacheOperation op,
+        boolean retval,
+        @Nullable ExpiryPolicy expiryPlc,
+        @Nullable Object[] invokeArgs,
+        @Nullable CacheEntryPredicate[] filter,
+        @Nullable UUID subjId,
+        int taskNameHash,
+        boolean skipStore,
+        boolean keepBinary,
+        boolean clientReq,
+        boolean addDepInfo,
+        int maxEntryCnt
+    ) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.fastMap = fastMap;
+        this.updateVer = updateVer;
+
+        this.topVer = topVer;
+        this.topLocked = topLocked;
+        this.syncMode = syncMode;
+        this.op = op;
+        this.retval = retval;
+        this.expiryPlc = expiryPlc;
+        this.invokeArgs = invokeArgs;
+        this.filter = filter;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.skipStore = skipStore;
+        this.keepBinary = keepBinary;
+        this.clientReq = clientReq;
+        this.addDepInfo = addDepInfo;
+
+        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
+        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
+        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
+        // than 10, we use it.
+        initSize = Math.min(maxEntryCnt, 10);
+
+        keys = new ArrayList<>(initSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean fastMap() {
+        return fastMap;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion updateVersion() {
+        return updateVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean topologyLocked() {
+        return topLocked;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean clientRequest() {
+        return clientReq;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ExpiryPolicy expiry() {
+        return expiryPlc;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean returnValue() {
+        return retval;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public CacheEntryPredicate[] filter() {
+        return filter;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean skipStore() {
+        return skipStore;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /**
+     * @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).
+     * @param primary If given key is primary on this mapping.
+     */
+    @SuppressWarnings("unchecked")
+    public void addUpdateEntry(KeyCacheObject key,
+        @Nullable Object val,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean primary) {
+        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;
+
+        keys.add(key);
+
+        if (entryProcessor != null) {
+            if (entryProcessors == null)
+                entryProcessors = new ArrayList<>(initSize);
+
+            entryProcessors.add(entryProcessor);
+        }
+        else if (val != null) {
+            assert val instanceof CacheObject : val;
+
+            if (vals == null)
+                vals = new ArrayList<>(initSize);
+
+            vals.add((CacheObject)val);
+        }
+
+        hasPrimary |= primary;
+
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>(initSize);
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictVers.add(null);
+            }
+
+            conflictVers.add(conflictVer);
+        }
+        else if (conflictVers != null)
+            conflictVers.add(null);
+
+        if (conflictTtl >= 0) {
+            if (conflictTtls == null) {
+                conflictTtls = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictTtls.add(CU.TTL_NOT_CHANGED);
+            }
+
+            conflictTtls.add(conflictTtl);
+        }
+
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+
+            conflictExpireTimes.add(conflictExpireTime);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<KeyCacheObject> keys() {
+        return keys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<?> values() {
+        return op == TRANSFORM ? entryProcessors : vals;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheOperation operation() {
+        return op;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public CacheObject value(int idx) {
+        assert op == UPDATE : op;
+
+        return vals.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        assert op == TRANSFORM : op;
+
+        return entryProcessors.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheObject writeValue(int idx) {
+        if (vals != null)
+            return vals.get(idx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
+        return conflictVers;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
+
+            return conflictVers.get(idx);
+        }
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictTtl(int idx) {
+        if (conflictTtls != null) {
+            assert idx >= 0 && idx < conflictTtls.size();
+
+            return conflictTtls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
+
+            return conflictExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean hasPrimary() {
+        return hasPrimary;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
+        if (this.res == null) {
+            this.res = res;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(keys, cctx);
+
+        if (filter != null) {
+            boolean hasFilter = false;
+
+            for (CacheEntryPredicate p : filter) {
+                if (p != null) {
+                    hasFilter = true;
+
+                    p.prepareMarshal(cctx);
+                }
+            }
+
+            if (!hasFilter)
+                filter = null;
+        }
+
+        if (expiryPlc != null && expiryPlcBytes == null)
+            expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+
+        if (op == TRANSFORM) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (entryProcessorsBytes == null)
+                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+        }
+        else
+            prepareMarshalCacheObjects(vals, cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+        if (op == TRANSFORM) {
+            if (entryProcessors == null)
+                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+        }
+        else
+            finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+        if (filter != null) {
+            for (CacheEntryPredicate p : filter) {
+                if (p != null)
+                    p.finishUnmarshal(cctx, ldr);
+            }
+        }
+
+        if (expiryPlcBytes != null && expiryPlc == null)
+            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeBoolean("clientReq", clientReq))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("conflictTtls", conflictTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("fastMap", fastMap))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeBoolean("hasPrimary", hasPrimary))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeBoolean("retval", retval))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeBoolean("skipStore", skipStore))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeBoolean("topLocked", topLocked))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("updateVer", updateVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 25:
+                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                clientReq = reader.readBoolean("clientReq");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                conflictTtls = reader.readMessage("conflictTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                fastMap = reader.readBoolean("fastMap");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                hasPrimary = reader.readBoolean("hasPrimary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                byte opOrd;
+
+                opOrd = reader.readByte("op");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                op = GridCacheOperation.fromOrdinal(opOrd);
+
+                reader.incrementState();
+
+            case 17:
+                retval = reader.readBoolean("retval");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                skipStore = reader.readBoolean("skipStore");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 19:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 21:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                topLocked = reader.readBoolean("topLocked");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                updateVer = reader.readMessage("updateVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 25:
+                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cleanup(boolean clearKeys) {
+        vals = null;
+        entryProcessors = null;
+        entryProcessorsBytes = null;
+        invokeArgs = null;
+        invokeArgsBytes = null;
+
+        if (clearKeys)
+            keys = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 40;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 26;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
+            "parent", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
new file mode 100644
index 0000000..2295854
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -0,0 +1,642 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * DHT atomic cache near update response.
+ */
+public class GridNearAtomicUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID this reply should be sent to. */
+    @GridDirectTransient
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Update error. */
+    @GridDirectTransient
+    private volatile IgniteCheckedException err;
+
+    /** Serialized error. */
+    private byte[] errBytes;
+
+    /** Return value. */
+    @GridToStringInclude
+    private GridCacheReturn ret;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private volatile Collection<KeyCacheObject> failedKeys;
+
+    /** Keys that should be remapped. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> remapKeys;
+
+    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearValsIdxs;
+
+    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
+    @GridDirectCollection(int.class)
+    private List<Integer> nearSkipIdxs;
+
+    /** Values generated on primary node which should be put to originating node's near cache. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Version generated on primary node to be used for originating node's near cache update. */
+    private GridCacheVersion nearVer;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridNearAtomicUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID this reply should be sent to.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info flag.
+     */
+    public GridNearAtomicUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
+        assert futVer != null;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Node ID this response should be sent to.
+     */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @param nodeId Node ID.
+     */
+    @Override public void nodeId(UUID nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /**
+     * @return Future version.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    @Override public void error(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /**
+     * @return Collection of failed keys.
+     */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /**
+     * @return Return value.
+     */
+    @Override public GridCacheReturn returnValue() {
+        return ret;
+    }
+
+    /**
+     * @param ret Return value.
+     */
+    @Override @SuppressWarnings("unchecked")
+    public void returnValue(GridCacheReturn ret) {
+        this.ret = ret;
+    }
+
+    /**
+     * @param remapKeys Remap keys.
+     */
+    @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
+        this.remapKeys = remapKeys;
+    }
+
+    /**
+     * @return Remap keys.
+     */
+    @Override public Collection<KeyCacheObject> remapKeys() {
+        return remapKeys;
+    }
+
+    /**
+     * Adds value to be put in near cache on originating node.
+     *
+     * @param keyIdx Key index.
+     * @param val Value.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @Override public void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime) {
+        if (nearValsIdxs == null) {
+            nearValsIdxs = new ArrayList<>();
+            nearVals = new ArrayList<>();
+        }
+
+        addNearTtl(keyIdx, ttl, expireTime);
+
+        nearValsIdxs.add(keyIdx);
+        nearVals.add(val);
+    }
+
+    /**
+     * @param keyIdx Key index.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @Override @SuppressWarnings("ForLoopReplaceableByForEach")
+    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearTtls.add(-1L);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(16);
+
+                for (int i = 0; i < keyIdx; i++)
+                    nearExpireTimes.add(-1);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return -1L;
+    }
+
+    /**
+     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+     */
+    @Override public void nearVersion(GridCacheVersion nearVer) {
+        this.nearVer = nearVer;
+    }
+
+    /**
+     * @return Version generated on primary node to be used for originating node's near cache update.
+     */
+    @Override public GridCacheVersion nearVersion() {
+        return nearVer;
+    }
+
+    /**
+     * @param keyIdx Index of key for which update was skipped
+     */
+    @Override public void addSkippedIndex(int keyIdx) {
+        if (nearSkipIdxs == null)
+            nearSkipIdxs = new ArrayList<>();
+
+        nearSkipIdxs.add(keyIdx);
+
+        addNearTtl(keyIdx, -1L, -1L);
+    }
+
+    /**
+     * @return Indexes of keys for which update was skipped
+     */
+    @Override @Nullable public List<Integer> skippedIndexes() {
+        return nearSkipIdxs;
+    }
+
+    /**
+     * @return Indexes of keys for which values were generated on primary node.
+     */
+    @Override @Nullable public List<Integer> nearValuesIndexes() {
+        return nearValsIdxs;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Value generated on primary node which should be put to originating node's near cache.
+     */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        return nearVals.get(idx);
+    }
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ConcurrentLinkedQueue<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
+        if (keys != null) {
+            if (failedKeys == null)
+                failedKeys = new ArrayList<>(keys.size());
+
+            failedKeys.addAll(keys);
+        }
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     * @param ctx Context.
+     */
+    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
+        GridCacheContext ctx) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>(keys.size());
+
+        failedKeys.addAll(keys);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc}
+     * @param ctx*/
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        if (err != null && errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(remapKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        if (ret != null)
+            ret.prepareMarshal(cctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        if (ret != null)
+            ret.finishUnmarshal(cctx, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeMessage("nearVer", nearVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeMessage("ret", ret))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearVer = reader.readMessage("nearVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                ret = reader.readMessage("ret");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridNearAtomicUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 41;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 14;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearAtomicUpdateResponse.class, this, "parent");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index ea6f889..5d5344e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -29,7 +29,6 @@ import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicReference;
-import javax.cache.Cache;
 import javax.cache.CacheException;
 import junit.framework.AssertionFailedError;
 import org.apache.ignite.Ignite;
@@ -51,8 +50,7 @@ import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
@@ -818,7 +816,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
                         if (ccfg.getAtomicityMode() == ATOMIC)
                             checkOperationInProgressFails(client, ccfg, F.<Class<?>>asList(
-                                GridNearAtomicMultipleUpdateResponse.class, GridNearAtomicSingleUpdateResponse.class),
+                                GridNearAtomicUpdateResponse.class, GridNearAtomicSingleUpdateResponse.class),
                                 putOp);
                         else
                             checkOperationInProgressFails(client, ccfg, GridNearTxPrepareResponse.class, putOp);

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index 4c011db..22d56b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.IgniteClientDisconnectedException;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponseInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.testframework.GridTestUtils;
@@ -316,7 +316,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicMultipleUpdateResponse.class);
+            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index b56a8a6..358cc58 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -27,10 +27,10 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -139,9 +139,9 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
             TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
 
-            commSpi.registerMessage(GridNearAtomicMultipleUpdateRequest.class);
+            commSpi.registerMessage(GridNearAtomicUpdateRequest.class);
             commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
-            commSpi.registerMessage(GridDhtAtomicMultipleUpdateRequest.class);
+            commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
             commSpi.registerMessage(GridDhtAtomicSingleUpdateRequest.class);
 
             int putCnt = 15;
@@ -201,7 +201,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int nearRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridNearAtomicMultipleUpdateRequest.class) +
+        return commSpi.messageCount(GridNearAtomicUpdateRequest.class) +
             commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class);
     }
 
@@ -212,7 +212,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int dhtRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridDhtAtomicMultipleUpdateRequest.class) +
+        return commSpi.messageCount(GridDhtAtomicUpdateRequest.class) +
             commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index 43a111a..024ff2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 
 /**
  * Stopped node when client operations are executing.
@@ -32,7 +32,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPut() throws Exception {
-        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -40,7 +40,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPutBatch() throws Exception {
-        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -48,7 +48,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPutAsync() throws Exception {
-        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -56,7 +56,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testRemove() throws Exception {
-        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 4733e19..8ecef5d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -62,7 +62,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
@@ -233,10 +233,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
@@ -278,7 +278,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
             map.put(i, i + 1);
 
         // Block messages requests for single node.
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
         putFut = GridTestUtils.runAsync(new Callable<Object>() {
@@ -366,16 +366,16 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite2.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite2.localNode().id());
 
-        spi.record(GridNearAtomicMultipleUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
+        spi.record(GridNearAtomicUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
 
         final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
 
@@ -469,10 +469,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/28c20c30/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 0786b49..b6c89c7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -478,9 +478,9 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             Object origMsg = msg.message();
 
             return delay && (
-                (origMsg instanceof GridNearAtomicMultipleUpdateRequest) ||
+                (origMsg instanceof GridNearAtomicUpdateRequest) ||
                 (origMsg instanceof GridNearAtomicSingleUpdateRequest) ||
-                (origMsg instanceof GridDhtAtomicMultipleUpdateRequest) ||
+                (origMsg instanceof GridDhtAtomicUpdateRequest) ||
                 (origMsg instanceof GridDhtAtomicSingleUpdateRequest)
             );
         }


[17/51] [abbrv] ignite git commit: Merge branch 'master' into ignite-2523

Posted by vo...@apache.org.
Merge branch 'master' into ignite-2523


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

Branch: refs/heads/ignite-2523
Commit: 11a27f74f5a85320f6473a4cd2e59e35459cc587
Parents: 1491c1f 532b373
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Feb 5 10:07:02 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 5 10:07:02 2016 +0300

----------------------------------------------------------------------
 .../jmh/cache/JmhCacheAbstractBenchmark.java    |   3 +
 .../benchmarks/jmh/cache/JmhCacheBenchmark.java | 145 +++++++++++++++++++
 .../jmh/cache/JmhCachePutBenchmark.java         | 124 ----------------
 .../jmh/runner/JmhIdeBenchmarkRunner.java       |  20 ++-
 .../ignite/internal/util/nio/GridNioServer.java |  28 +---
 .../osgi-karaf/src/main/resources/features.xml  |  12 +-
 6 files changed, 168 insertions(+), 164 deletions(-)
----------------------------------------------------------------------



[40/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java
new file mode 100644
index 0000000..f521f7d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponseInterface.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Base interface for near atomic update responses.
+ */
+public interface GridNearAtomicUpdateResponseInterface extends Message {
+
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
+    int lookupIndex();
+
+    /**
+     * @return Mapped node ID.
+     */
+    UUID nodeId();
+
+    /**
+     * @param nodeId Node ID.
+     */
+    void nodeId(UUID nodeId);
+
+    /**
+     * @return Future version.
+     */
+    GridCacheVersion futureVersion();
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    void error(IgniteCheckedException err);
+
+    /**
+     * @return Error, if any.
+     */
+    IgniteCheckedException error();
+
+    /**
+     * @return Collection of failed keys.
+     */
+    Collection<KeyCacheObject> failedKeys();
+
+    /**
+     * @return Return value.
+     */
+    GridCacheReturn returnValue();
+
+    /**
+     * @param ret Return value.
+     */
+    @SuppressWarnings("unchecked") void returnValue(GridCacheReturn ret);
+
+    /**
+     * @param remapKeys Remap keys.
+     */
+    void remapKeys(List<KeyCacheObject> remapKeys);
+
+    /**
+     * @return Remap keys.
+     */
+    Collection<KeyCacheObject> remapKeys();
+
+    /**
+     * Adds value to be put in near cache on originating node.
+     *
+     * @param keyIdx Key index.
+     * @param val Value.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    void addNearValue(int keyIdx,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime);
+
+    /**
+     * @param keyIdx Key index.
+     * @param ttl TTL for near cache update.
+     * @param expireTime Expire time for near cache update.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach") void addNearTtl(int keyIdx, long ttl, long expireTime);
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    long nearExpireTime(int idx);
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    long nearTtl(int idx);
+
+    /**
+     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+     */
+    void nearVersion(GridCacheVersion nearVer);
+
+    /**
+     * @return Version generated on primary node to be used for originating node's near cache update.
+     */
+    GridCacheVersion nearVersion();
+
+    /**
+     * @param keyIdx Index of key for which update was skipped
+     */
+    void addSkippedIndex(int keyIdx);
+
+    /**
+     * @return Indexes of keys for which update was skipped
+     */
+    @Nullable List<Integer> skippedIndexes();
+
+    /**
+     * @return Indexes of keys for which values were generated on primary node.
+     */
+    @Nullable List<Integer> nearValuesIndexes();
+
+    /**
+     * @param idx Index.
+     * @return Value generated on primary node which should be put to originating node's near cache.
+     */
+    @Nullable CacheObject nearValue(int idx);
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    void addFailedKey(KeyCacheObject key, Throwable e);
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     */
+    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e);
+
+    /**
+     * Adds keys to collection of failed keys.
+     *
+     * @param keys Key to add.
+     * @param e Error cause.
+     * @param ctx Context.
+     */
+    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx);
+
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
+
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
+
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
+    boolean addDeploymentInfo();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 4f133e1..efe8347 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -33,10 +33,10 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequestInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponseInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponseInterface;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -125,8 +125,8 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      * @param res Update response.
      */
     public void processNearAtomicUpdateResponse(
-        GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res
+        GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateResponseInterface res
     ) {
         if (F.size(res.failedKeys()) == req.keys().size())
             return;
@@ -300,8 +300,8 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      */
     public void processDhtAtomicUpdateRequest(
         UUID nodeId,
-        GridDhtAtomicUpdateRequest req,
-        GridDhtAtomicUpdateResponse res
+        GridDhtAtomicUpdateRequestInterface req,
+        GridDhtAtomicUpdateResponseInterface res
     ) {
         GridCacheVersion ver = req.writeVersion();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index 5509496..4c011db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponseInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.testframework.GridTestUtils;
 
@@ -458,7 +458,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
+            commSpi.blockMessage(GridNearAtomicUpdateResponseInterface.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 49686fc..4733e19 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -63,7 +63,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -412,7 +412,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         assertEquals(3, msgs.size());
 
         for (Object msg : msgs)
-            assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());
+            assertTrue(((GridNearAtomicUpdateRequestInterface)msg).clientRequest());
 
         map.put(primaryKey(ignite0.cache(null)), 3);
         map.put(primaryKey(ignite1.cache(null)), 4);


[22/51] [abbrv] ignite git commit: ignite-2523 : Generalized usage of GridNearAtomicUpdateRequest/Response.

Posted by vo...@apache.org.
ignite-2523 : Generalized usage of GridNearAtomicUpdateRequest/Response.


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

Branch: refs/heads/ignite-2523
Commit: 3c8d02a00b2bcbc194fd2112d9f8cb58ab7d571a
Parents: c39410a
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Mon Feb 8 18:25:21 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Mon Feb 8 18:25:21 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheIoManager.java    |  3 ++-
 .../GridNearAtomicMultipleUpdateRequest.java    |  6 +++---
 .../GridNearAtomicSingleUpdateRequest.java      |  6 +++---
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 22 +++++++++++++-------
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  4 ++--
 .../distributed/near/GridNearAtomicCache.java   |  3 ++-
 6 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3c8d02a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index ea97277..7ba9542 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDh
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest;
@@ -590,7 +591,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             case -23: {
                 GridNearAtomicSingleUpdateRequest req = (GridNearAtomicSingleUpdateRequest)msg;
 
-                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(
+                GridNearAtomicSingleUpdateResponse res = new GridNearAtomicSingleUpdateResponse(
                     ctx.cacheId(),
                     nodeId,
                     req.futureVersion(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c8d02a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index 6f109be..650d350 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -157,7 +157,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicMultipleUpdateResponse res;
+    private GridNearAtomicUpdateResponse res;
 
     /** Maximum possible size of inner collections. */
     @GridDirectTransient
@@ -502,7 +502,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicMultipleUpdateResponse res) {
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -513,7 +513,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicMultipleUpdateResponse response() {
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c8d02a0/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 8714010..1e981af 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
@@ -149,7 +149,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicMultipleUpdateResponse res;
+    private GridNearAtomicUpdateResponse res;
 
     /**
      * Empty constructor required by {@link Externalizable}.
@@ -427,7 +427,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicMultipleUpdateResponse res) {
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -438,7 +438,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicMultipleUpdateResponse response() {
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c8d02a0/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 68ee67b..682935f 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
@@ -349,7 +349,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param req Update request.
      * @param res Update response.
      */
-    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicMultipleUpdateResponse res) {
+    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
         assert nearEnabled;
 
         if (res.remapKeys() != null || !req.hasPrimary())
@@ -570,7 +570,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeId Left node ID.
          */
         void onNodeLeft(UUID nodeId) {
-            GridNearAtomicMultipleUpdateResponse res = null;
+            GridNearAtomicUpdateResponse res = null;
 
             synchronized (this) {
                 GridNearAtomicUpdateRequest req;
@@ -581,10 +581,16 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                     req = mappings != null ? mappings.get(nodeId) : null;
 
                 if (req != null && req.response() == null) {
-                    res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
-                        nodeId,
-                        req.futureVersion(),
-                        cctx.deploymentEnabled());
+                    if (req instanceof GridNearAtomicSingleUpdateRequest)
+                        res = new GridNearAtomicSingleUpdateResponse(cctx.cacheId(),
+                            nodeId,
+                            req.futureVersion(),
+                            cctx.deploymentEnabled());
+                    else
+                        res = new GridNearAtomicMultipleUpdateResponse(cctx.cacheId(),
+                            nodeId,
+                            req.futureVersion(),
+                            cctx.deploymentEnabled());
 
                     ClusterTopologyCheckedException e = new ClusterTopologyCheckedException("Primary node left grid " +
                         "before response is received: " + nodeId);
@@ -605,7 +611,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeErr {@code True} if response was created on node failure.
          */
         @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
-        void onResult(UUID nodeId, GridNearAtomicMultipleUpdateResponse res, boolean nodeErr) {
+        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
             GridNearAtomicUpdateRequest req;
 
             AffinityTopologyVersion remapTopVer = null;
@@ -737,7 +743,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
                     for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
-                        GridNearAtomicMultipleUpdateResponse res0 = req0.response();
+                        GridNearAtomicUpdateResponse res0 = req0.response();
 
                         assert res0 != null : req0;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c8d02a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index c1977bf..960add7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -190,10 +190,10 @@ public interface GridNearAtomicUpdateRequest {
      * @param res Response.
      * @return {@code True} if current response was {@code null}.
      */
-    public boolean onResponse(GridNearAtomicMultipleUpdateResponse res);
+    public boolean onResponse(GridNearAtomicUpdateResponse res);
 
     /**
      * @return Response.
      */
-    @Nullable public GridNearAtomicMultipleUpdateResponse response();
+    @Nullable public GridNearAtomicUpdateResponse response();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c8d02a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 2546691..5aef8e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDh
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -128,7 +129,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      */
     public void processNearAtomicUpdateResponse(
         GridNearAtomicUpdateRequest req,
-        GridNearAtomicMultipleUpdateResponse res
+        GridNearAtomicUpdateResponse res
     ) {
         if (F.size(res.failedKeys()) == req.keys().size())
             return;


[48/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
Review.


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

Branch: refs/heads/ignite-2523
Commit: 1829f44188582be33a1d0d74538cc8b1bc265531
Parents: f83d909
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:20:12 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:20:12 2016 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |   16 +-
 .../processors/cache/GridCacheIoManager.java    |   16 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   20 +-
 .../GridDhtAtomicMultipleUpdateRequest.java     | 1004 ++++++++++++++++++
 .../GridDhtAtomicMultipleUpdateResponse.java    |  279 +++++
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |    4 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 1004 ------------------
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  279 -----
 .../GridNearAtomicMultipleUpdateRequest.java    |  989 +++++++++++++++++
 .../GridNearAtomicMultipleUpdateResponse.java   |  575 ++++++++++
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   30 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  989 -----------------
 .../atomic/GridNearAtomicUpdateResponse.java    |  575 ----------
 .../IgniteClientReconnectCacheTest.java         |    4 +-
 .../IgniteClientReconnectCollectionsTest.java   |    4 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |   12 +-
 .../IgniteCacheAtomicStopBusySelfTest.java      |   10 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   20 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    4 +-
 19 files changed, 2917 insertions(+), 2917 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index e44ad00..2366104 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -66,13 +66,13 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrep
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -356,22 +356,22 @@ public class GridIoMessageFactory implements MessageFactory {
                 break;
 
             case 38:
-                msg = new GridDhtAtomicUpdateRequest();
+                msg = new GridDhtAtomicMultipleUpdateRequest();
 
                 break;
 
             case 39:
-                msg = new GridDhtAtomicUpdateResponse();
+                msg = new GridDhtAtomicMultipleUpdateResponse();
 
                 break;
 
             case 40:
-                msg = new GridNearAtomicUpdateRequest();
+                msg = new GridNearAtomicMultipleUpdateRequest();
 
                 break;
 
             case 41:
-                msg = new GridNearAtomicUpdateResponse();
+                msg = new GridNearAtomicMultipleUpdateResponse();
 
                 break;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 48a0b9f..2ec8dd9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -34,12 +34,12 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRe
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
@@ -398,9 +398,9 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 38: {
-                GridDhtAtomicUpdateRequest req = (GridDhtAtomicUpdateRequest)msg;
+                GridDhtAtomicMultipleUpdateRequest req = (GridDhtAtomicMultipleUpdateRequest)msg;
 
-                GridDhtAtomicUpdateResponse res = new GridDhtAtomicUpdateResponse(
+                GridDhtAtomicMultipleUpdateResponse res = new GridDhtAtomicMultipleUpdateResponse(
                     ctx.cacheId(),
                     req.futureVersion(),
                     ctx.deploymentEnabled());
@@ -413,9 +413,9 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             break;
 
             case 40: {
-                GridNearAtomicUpdateRequest req = (GridNearAtomicUpdateRequest)msg;
+                GridNearAtomicMultipleUpdateRequest req = (GridNearAtomicMultipleUpdateRequest)msg;
 
-                GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+                GridNearAtomicMultipleUpdateResponse res = new GridNearAtomicMultipleUpdateResponse(
                     ctx.cacheId(),
                     nodeId,
                     req.futureVersion(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 4c07bf2..6965a9c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -252,8 +252,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateRequest.class, new CI2<UUID, GridNearAtomicUpdateRequest>() {
-            @Override public void apply(UUID nodeId, GridNearAtomicUpdateRequest req) {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateRequest.class, new CI2<UUID, GridNearAtomicMultipleUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateRequest req) {
                 processNearAtomicUpdateRequest(nodeId, req);
             }
         });
@@ -264,8 +264,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicUpdateResponse.class, new CI2<UUID, GridNearAtomicUpdateResponse>() {
-            @Override public void apply(UUID nodeId, GridNearAtomicUpdateResponse res) {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateResponse.class, new CI2<UUID, GridNearAtomicMultipleUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
                 processNearAtomicUpdateResponse(nodeId, res);
             }
         });
@@ -276,8 +276,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateRequest.class, new CI2<UUID, GridDhtAtomicUpdateRequest>() {
-            @Override public void apply(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateRequest.class, new CI2<UUID, GridDhtAtomicMultipleUpdateRequest>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateRequest req) {
                 processDhtAtomicUpdateRequest(nodeId, req);
             }
         });
@@ -288,8 +288,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicUpdateResponse.class, new CI2<UUID, GridDhtAtomicUpdateResponse>() {
-            @Override public void apply(UUID nodeId, GridDhtAtomicUpdateResponse res) {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateResponse.class, new CI2<UUID, GridDhtAtomicMultipleUpdateResponse>() {
+            @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateResponse res) {
                 processDhtAtomicUpdateResponse(nodeId, res);
             }
         });
@@ -1365,7 +1365,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             res = new GridNearAtomicSingleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
                 ctx.deploymentEnabled());
         else
-            res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
+            res = new GridNearAtomicMultipleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
                 ctx.deploymentEnabled());
 
         List<KeyCacheObject> keys = req.keys();
@@ -2831,7 +2831,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             res = new GridDhtAtomicSingleUpdateResponse(ctx.cacheId(), req.futureVersion(),
                 ctx.deploymentEnabled());
         else
-            res = new GridDhtAtomicUpdateResponse(ctx.cacheId(), req.futureVersion(),
+            res = new GridDhtAtomicMultipleUpdateResponse(ctx.cacheId(), req.futureVersion(),
                 ctx.deploymentEnabled());
 
         Boolean replicate = ctx.isDrEnabled();

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
new file mode 100644
index 0000000..de89b47
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
@@ -0,0 +1,1004 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Lite dht cache backup update request.
+ */
+public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Write version. */
+    private GridCacheVersion writeVer;
+
+    /** Topology version. */
+    private AffinityTopologyVersion topVer;
+
+    /** Keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> keys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> vals;
+
+    /** Previous values. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> prevVals;
+
+    /** Conflict versions. */
+    @GridDirectCollection(GridCacheVersion.class)
+    private List<GridCacheVersion> conflictVers;
+
+    /** TTLs. */
+    private GridLongList ttls;
+
+    /** Conflict expire time. */
+    private GridLongList conflictExpireTimes;
+
+    /** Near TTLs. */
+    private GridLongList nearTtls;
+
+    /** Near expire times. */
+    private GridLongList nearExpireTimes;
+
+    /** Write synchronization mode. */
+    private CacheWriteSynchronizationMode syncMode;
+
+    /** Near cache keys to update. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearKeys;
+
+    /** Values to update. */
+    @GridToStringInclude
+    @GridDirectCollection(CacheObject.class)
+    private List<CacheObject> nearVals;
+
+    /** Force transform backups flag. */
+    private boolean forceTransformBackups;
+
+    /** Entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+    /** Entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> entryProcessorsBytes;
+
+    /** Near entry processors. */
+    @GridDirectTransient
+    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
+
+    /** Near entry processors bytes. */
+    @GridDirectCollection(byte[].class)
+    private List<byte[]> nearEntryProcessorsBytes;
+
+    /** Optional arguments for entry processor. */
+    @GridDirectTransient
+    private Object[] invokeArgs;
+
+    /** Entry processor arguments bytes. */
+    private byte[][] invokeArgsBytes;
+
+    /** Subject ID. */
+    private UUID subjId;
+
+    /** Task name hash. */
+    private int taskNameHash;
+
+    /** Partition. */
+    private GridLongList updateCntrs;
+
+    /** On response flag. Access should be synced on future. */
+    @GridDirectTransient
+    private boolean onRes;
+
+    /** */
+    @GridDirectTransient
+    private List<Integer> partIds;
+
+    /** */
+    @GridDirectTransient
+    private List<CacheObject> locPrevVals;
+
+    /** Keep binary flag. */
+    private boolean keepBinary;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicMultipleUpdateRequest() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cacheId Cache ID.
+     * @param nodeId Node ID.
+     * @param futVer Future version.
+     * @param writeVer Write version for cache values.
+     * @param invokeArgs Optional arguments for entry processor.
+     * @param syncMode Cache write synchronization mode.
+     * @param topVer Topology version.
+     * @param forceTransformBackups Force transform backups flag.
+     * @param subjId Subject ID.
+     * @param taskNameHash Task name hash code.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicMultipleUpdateRequest(
+        int cacheId,
+        UUID nodeId,
+        GridCacheVersion futVer,
+        GridCacheVersion writeVer,
+        CacheWriteSynchronizationMode syncMode,
+        @NotNull AffinityTopologyVersion topVer,
+        boolean forceTransformBackups,
+        UUID subjId,
+        int taskNameHash,
+        Object[] invokeArgs,
+        boolean addDepInfo,
+        boolean keepBinary
+    ) {
+        assert invokeArgs == null || forceTransformBackups;
+
+        this.cacheId = cacheId;
+        this.nodeId = nodeId;
+        this.futVer = futVer;
+        this.writeVer = writeVer;
+        this.syncMode = syncMode;
+        this.topVer = topVer;
+        this.forceTransformBackups = forceTransformBackups;
+        this.subjId = subjId;
+        this.taskNameHash = taskNameHash;
+        this.invokeArgs = invokeArgs;
+        this.addDepInfo = addDepInfo;
+        this.keepBinary = keepBinary;
+
+        keys = new ArrayList<>();
+        partIds = new ArrayList<>();
+
+        if (forceTransformBackups) {
+            entryProcessors = new ArrayList<>();
+            entryProcessorsBytes = new ArrayList<>();
+        }
+        else
+            vals = new ArrayList<>();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean forceTransformBackups() {
+        return forceTransformBackups;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean addPrevVal,
+        int partId,
+        @Nullable CacheObject prevVal,
+        @Nullable Long updateCntr,
+        boolean storeLocPrevVal) {
+        keys.add(key);
+
+        partIds.add(partId);
+
+        if (storeLocPrevVal) {
+            if (locPrevVals == null)
+                locPrevVals = new ArrayList<>();
+
+            locPrevVals.add(prevVal);
+        }
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            entryProcessors.add(entryProcessor);
+        }
+        else
+            vals.add(val);
+
+        if (addPrevVal) {
+            if (prevVals == null)
+                prevVals = new ArrayList<>();
+
+            prevVals.add(prevVal);
+        }
+
+        if (updateCntr != null) {
+            if (updateCntrs == null)
+                updateCntrs = new GridLongList();
+
+            updateCntrs.add(updateCntr);
+        }
+
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>();
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictVers.add(null);
+            }
+
+            conflictVers.add(conflictVer);
+        }
+        else if (conflictVers != null)
+            conflictVers.add(null);
+
+        if (ttl >= 0) {
+            if (ttls == null) {
+                ttls = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    ttls.add(CU.TTL_NOT_CHANGED);
+            }
+        }
+
+        if (ttls != null)
+            ttls.add(ttl);
+
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
+
+                for (int i = 0; i < keys.size() - 1; i++)
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+        }
+
+        if (conflictExpireTimes != null)
+            conflictExpireTimes.add(conflictExpireTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addNearWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long expireTime) {
+        if (nearKeys == null) {
+            nearKeys = new ArrayList<>();
+
+            if (forceTransformBackups) {
+                nearEntryProcessors = new ArrayList<>();
+                nearEntryProcessorsBytes = new ArrayList<>();
+            }
+            else
+                nearVals = new ArrayList<>();
+        }
+
+        nearKeys.add(key);
+
+        if (forceTransformBackups) {
+            assert entryProcessor != null;
+
+            nearEntryProcessors.add(entryProcessor);
+        }
+        else
+            nearVals.add(val);
+
+        if (ttl >= 0) {
+            if (nearTtls == null) {
+                nearTtls = new GridLongList(nearKeys.size());
+
+                for (int i = 0; i < nearKeys.size() - 1; i++)
+                    nearTtls.add(CU.TTL_NOT_CHANGED);
+            }
+        }
+
+        if (nearTtls != null)
+            nearTtls.add(ttl);
+
+        if (expireTime >= 0) {
+            if (nearExpireTimes == null) {
+                nearExpireTimes = new GridLongList(nearKeys.size());
+
+                for (int i = 0; i < nearKeys.size() - 1; i++)
+                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+            }
+        }
+
+        if (nearExpireTimes != null)
+            nearExpireTimes.add(expireTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
+        return nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID subjectId() {
+        return subjId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int taskNameHash() {
+        return taskNameHash;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return keys.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nearSize() {
+        return nearKeys != null ? nearKeys.size() : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion writeVersion() {
+        return writeVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+        return syncMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<KeyCacheObject> keys() {
+        return keys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public KeyCacheObject key(int idx) {
+        return keys.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int partitionId(int idx) {
+        return partIds.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Long updateCounter(int updCntr) {
+        if (updateCntrs != null && updCntr < updateCntrs.size())
+            return updateCntrs.get(updCntr);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public KeyCacheObject nearKey(int idx) {
+        return nearKeys.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean keepBinary() {
+        return keepBinary;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public CacheObject value(int idx) {
+        if (vals != null)
+            return vals.get(idx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public CacheObject previousValue(int idx) {
+        if (prevVals != null)
+            return prevVals.get(idx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public CacheObject localPreviousValue(int idx) {
+        assert locPrevVals != null;
+
+        return locPrevVals.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        return entryProcessors == null ? null : entryProcessors.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public CacheObject nearValue(int idx) {
+        if (nearVals != null)
+            return nearVals.get(idx);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
+        return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
+
+            return conflictVers.get(idx);
+        }
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long ttl(int idx) {
+        if (ttls != null) {
+            assert idx >= 0 && idx < ttls.size();
+
+            return ttls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nearTtl(int idx) {
+        if (nearTtls != null) {
+            assert idx >= 0 && idx < nearTtls.size();
+
+            return nearTtls.get(idx);
+        }
+
+        return CU.TTL_NOT_CHANGED;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
+
+            return conflictExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nearExpireTime(int idx) {
+        if (nearExpireTimes != null) {
+            assert idx >= 0 && idx < nearExpireTimes.size();
+
+            return nearExpireTimes.get(idx);
+        }
+
+        return CU.EXPIRE_TIME_CALCULATE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onResponse() {
+        return !onRes && (onRes = true);
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Object[] invokeArguments() {
+        return invokeArgs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(keys, cctx);
+
+        prepareMarshalCacheObjects(vals, cctx);
+
+        prepareMarshalCacheObjects(nearKeys, cctx);
+
+        prepareMarshalCacheObjects(nearVals, cctx);
+
+        prepareMarshalCacheObjects(prevVals, cctx);
+
+        if (forceTransformBackups) {
+            // force addition of deployment info for entry processors if P2P is enabled globally.
+            if (!addDepInfo && ctx.deploymentEnabled())
+                addDepInfo = true;
+
+            if (invokeArgsBytes == null)
+                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+
+            if (entryProcessorsBytes == null)
+                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+            if (nearEntryProcessorsBytes == null)
+                nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, cctx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+
+        finishUnmarshalCacheObjects(prevVals, cctx, ldr);
+
+        if (forceTransformBackups) {
+            if (entryProcessors == null)
+                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+            if (invokeArgs == null)
+                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+
+            if (nearEntryProcessors == null)
+                nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 8:
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 9:
+                if (!writer.writeBoolean("keepBinary", keepBinary))
+                    return false;
+
+                writer.incrementState();
+
+            case 10:
+                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 11:
+                if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 12:
+                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
+                if (!writer.writeCollection("nearKeys", nearKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 14:
+                if (!writer.writeMessage("nearTtls", nearTtls))
+                    return false;
+
+                writer.incrementState();
+
+            case 15:
+                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 16:
+                if (!writer.writeCollection("prevVals", prevVals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 17:
+                if (!writer.writeUuid("subjId", subjId))
+                    return false;
+
+                writer.incrementState();
+
+            case 18:
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+                    return false;
+
+                writer.incrementState();
+
+            case 19:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 20:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeMessage("ttls", ttls))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeMessage("updateCntrs", updateCntrs))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
+                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 24:
+                if (!writer.writeMessage("writeVer", writeVer))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                forceTransformBackups = reader.readBoolean("forceTransformBackups");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 8:
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 9:
+                keepBinary = reader.readBoolean("keepBinary");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 10:
+                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 11:
+                nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 12:
+                nearExpireTimes = reader.readMessage("nearExpireTimes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
+                nearKeys = reader.readCollection("nearKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 14:
+                nearTtls = reader.readMessage("nearTtls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 15:
+                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 16:
+                prevVals = reader.readCollection("prevVals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 17:
+                subjId = reader.readUuid("subjId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 18:
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+                reader.incrementState();
+
+            case 19:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 20:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 21:
+                ttls = reader.readMessage("ttls");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                updateCntrs = reader.readMessage("updateCntrs");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
+                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 24:
+                writeVer = reader.readMessage("writeVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicMultipleUpdateRequest.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        cleanup();
+    }
+
+    /**
+     * Cleanup values not needed after message was sent.
+     */
+    private void cleanup() {
+        nearVals = null;
+        prevVals = null;
+
+        // Do not keep values if they are not needed for continuous query notification.
+        if (locPrevVals == null) {
+            keys = null;
+            vals = null;
+            locPrevVals = null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 38;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 25;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicMultipleUpdateRequest.class, this, "super", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
new file mode 100644
index 0000000..4853ef5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ * DHT atomic cache backup update response.
+ */
+public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> failedKeys;
+
+    /** Update error. */
+    @GridDirectTransient
+    private IgniteCheckedException err;
+
+    /** Serialized update error. */
+    private byte[] errBytes;
+
+    /** Evicted readers. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearEvicted;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicMultipleUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicMultipleUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
+        this.cacheId = cacheId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onError(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<KeyCacheObject> nearEvicted() {
+        return nearEvicted;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addNearEvicted(KeyCacheObject key) {
+        if (nearEvicted == null)
+            nearEvicted = new ArrayList<>();
+
+        nearEvicted.add(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(nearEvicted, cctx);
+
+        if (errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicMultipleUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 39;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 7;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicMultipleUpdateResponse.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 82cae3c..6e2ed31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -266,7 +266,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                             cctx.deploymentEnabled(),
                             this.updateReq.keepBinary());
                     else
-                        updateReq = new GridDhtAtomicUpdateRequest(
+                        updateReq = new GridDhtAtomicMultipleUpdateRequest(
                             cctx.cacheId(),
                             nodeId,
                             futVer,
@@ -362,7 +362,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                         cctx.deploymentEnabled(),
                         this.updateReq.keepBinary());
                 else
-                    updateReq = new GridDhtAtomicUpdateRequest(
+                    updateReq = new GridDhtAtomicMultipleUpdateRequest(
                         cctx.cacheId(),
                         nodeId,
                         futVer,

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
deleted file mode 100644
index 4ceac74..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ /dev/null
@@ -1,1004 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Lite dht cache backup update request.
- */
-public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Node ID. */
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Write version. */
-    private GridCacheVersion writeVer;
-
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Previous values. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> prevVals;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** TTLs. */
-    private GridLongList ttls;
-
-    /** Conflict expire time. */
-    private GridLongList conflictExpireTimes;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
-    /** Write synchronization mode. */
-    private CacheWriteSynchronizationMode syncMode;
-
-    /** Near cache keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearKeys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
-    /** Force transform backups flag. */
-    private boolean forceTransformBackups;
-
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Near entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
-
-    /** Near entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> nearEntryProcessorsBytes;
-
-    /** Optional arguments for entry processor. */
-    @GridDirectTransient
-    private Object[] invokeArgs;
-
-    /** Entry processor arguments bytes. */
-    private byte[][] invokeArgsBytes;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /** Task name hash. */
-    private int taskNameHash;
-
-    /** Partition. */
-    private GridLongList updateCntrs;
-
-    /** On response flag. Access should be synced on future. */
-    @GridDirectTransient
-    private boolean onRes;
-
-    /** */
-    @GridDirectTransient
-    private List<Integer> partIds;
-
-    /** */
-    @GridDirectTransient
-    private List<CacheObject> locPrevVals;
-
-    /** Keep binary flag. */
-    private boolean keepBinary;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridDhtAtomicUpdateRequest() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID.
-     * @param futVer Future version.
-     * @param writeVer Write version for cache values.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param syncMode Cache write synchronization mode.
-     * @param topVer Topology version.
-     * @param forceTransformBackups Force transform backups flag.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param addDepInfo Deployment info.
-     */
-    public GridDhtAtomicUpdateRequest(
-        int cacheId,
-        UUID nodeId,
-        GridCacheVersion futVer,
-        GridCacheVersion writeVer,
-        CacheWriteSynchronizationMode syncMode,
-        @NotNull AffinityTopologyVersion topVer,
-        boolean forceTransformBackups,
-        UUID subjId,
-        int taskNameHash,
-        Object[] invokeArgs,
-        boolean addDepInfo,
-        boolean keepBinary
-    ) {
-        assert invokeArgs == null || forceTransformBackups;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.writeVer = writeVer;
-        this.syncMode = syncMode;
-        this.topVer = topVer;
-        this.forceTransformBackups = forceTransformBackups;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.invokeArgs = invokeArgs;
-        this.addDepInfo = addDepInfo;
-        this.keepBinary = keepBinary;
-
-        keys = new ArrayList<>();
-        partIds = new ArrayList<>();
-
-        if (forceTransformBackups) {
-            entryProcessors = new ArrayList<>();
-            entryProcessorsBytes = new ArrayList<>();
-        }
-        else
-            vals = new ArrayList<>();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean forceTransformBackups() {
-        return forceTransformBackups;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean addPrevVal,
-        int partId,
-        @Nullable CacheObject prevVal,
-        @Nullable Long updateCntr,
-        boolean storeLocPrevVal) {
-        keys.add(key);
-
-        partIds.add(partId);
-
-        if (storeLocPrevVal) {
-            if (locPrevVals == null)
-                locPrevVals = new ArrayList<>();
-
-            locPrevVals.add(prevVal);
-        }
-
-        if (forceTransformBackups) {
-            assert entryProcessor != null;
-
-            entryProcessors.add(entryProcessor);
-        }
-        else
-            vals.add(val);
-
-        if (addPrevVal) {
-            if (prevVals == null)
-                prevVals = new ArrayList<>();
-
-            prevVals.add(prevVal);
-        }
-
-        if (updateCntr != null) {
-            if (updateCntrs == null)
-                updateCntrs = new GridLongList();
-
-            updateCntrs.add(updateCntr);
-        }
-
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>();
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (ttl >= 0) {
-            if (ttls == null) {
-                ttls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    ttls.add(CU.TTL_NOT_CHANGED);
-            }
-        }
-
-        if (ttls != null)
-            ttls.add(ttl);
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-        }
-
-        if (conflictExpireTimes != null)
-            conflictExpireTimes.add(conflictExpireTime);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addNearWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long expireTime) {
-        if (nearKeys == null) {
-            nearKeys = new ArrayList<>();
-
-            if (forceTransformBackups) {
-                nearEntryProcessors = new ArrayList<>();
-                nearEntryProcessorsBytes = new ArrayList<>();
-            }
-            else
-                nearVals = new ArrayList<>();
-        }
-
-        nearKeys.add(key);
-
-        if (forceTransformBackups) {
-            assert entryProcessor != null;
-
-            nearEntryProcessors.add(entryProcessor);
-        }
-        else
-            nearVals.add(val);
-
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(nearKeys.size());
-
-                for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearTtls.add(CU.TTL_NOT_CHANGED);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
-
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(nearKeys.size());
-
-                for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID subjectId() {
-        return subjId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int taskNameHash() {
-        return taskNameHash;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return keys.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int nearSize() {
-        return nearKeys != null ? nearKeys.size() : 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion writeVersion() {
-        return writeVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return syncMode;
-    }
-
-    /** {@inheritDoc} */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return topVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<KeyCacheObject> keys() {
-        return keys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public KeyCacheObject key(int idx) {
-        return keys.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int partitionId(int idx) {
-        return partIds.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Long updateCounter(int updCntr) {
-        if (updateCntrs != null && updCntr < updateCntrs.size())
-            return updateCntrs.get(updCntr);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public KeyCacheObject nearKey(int idx) {
-        return nearKeys.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean keepBinary() {
-        return keepBinary;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public CacheObject value(int idx) {
-        if (vals != null)
-            return vals.get(idx);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public CacheObject previousValue(int idx) {
-        if (prevVals != null)
-            return prevVals.get(idx);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public CacheObject localPreviousValue(int idx) {
-        assert locPrevVals != null;
-
-        return locPrevVals.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
-        return entryProcessors == null ? null : entryProcessors.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public CacheObject nearValue(int idx) {
-        if (nearVals != null)
-            return nearVals.get(idx);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
-        return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long ttl(int idx) {
-        if (ttls != null) {
-            assert idx >= 0 && idx < ttls.size();
-
-            return ttls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
-
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onResponse() {
-        return !onRes && (onRes = true);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public Object[] invokeArguments() {
-        return invokeArgs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(keys, cctx);
-
-        prepareMarshalCacheObjects(vals, cctx);
-
-        prepareMarshalCacheObjects(nearKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
-
-        prepareMarshalCacheObjects(prevVals, cctx);
-
-        if (forceTransformBackups) {
-            // force addition of deployment info for entry processors if P2P is enabled globally.
-            if (!addDepInfo && ctx.deploymentEnabled())
-                addDepInfo = true;
-
-            if (invokeArgsBytes == null)
-                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
-
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
-            if (nearEntryProcessorsBytes == null)
-                nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, cctx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(vals, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
-
-        finishUnmarshalCacheObjects(prevVals, cctx, ldr);
-
-        if (forceTransformBackups) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
-            if (invokeArgs == null)
-                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
-
-            if (nearEntryProcessors == null)
-                nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeCollection("nearKeys", nearKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 14:
-                if (!writer.writeMessage("nearTtls", nearTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
-                if (!writer.writeCollection("prevVals", prevVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 17:
-                if (!writer.writeUuid("subjId", subjId))
-                    return false;
-
-                writer.incrementState();
-
-            case 18:
-                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 19:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
-                    return false;
-
-                writer.incrementState();
-
-            case 20:
-                if (!writer.writeMessage("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 21:
-                if (!writer.writeMessage("ttls", ttls))
-                    return false;
-
-                writer.incrementState();
-
-            case 22:
-                if (!writer.writeMessage("updateCntrs", updateCntrs))
-                    return false;
-
-                writer.incrementState();
-
-            case 23:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 24:
-                if (!writer.writeMessage("writeVer", writeVer))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                forceTransformBackups = reader.readBoolean("forceTransformBackups");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                keepBinary = reader.readBoolean("keepBinary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                nearKeys = reader.readCollection("nearKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 14:
-                nearTtls = reader.readMessage("nearTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 15:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 16:
-                prevVals = reader.readCollection("prevVals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 17:
-                subjId = reader.readUuid("subjId");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 18:
-                byte syncModeOrd;
-
-                syncModeOrd = reader.readByte("syncMode");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
-
-                reader.incrementState();
-
-            case 19:
-                taskNameHash = reader.readInt("taskNameHash");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 20:
-                topVer = reader.readMessage("topVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 21:
-                ttls = reader.readMessage("ttls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 22:
-                updateCntrs = reader.readMessage("updateCntrs");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 23:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 24:
-                writeVer = reader.readMessage("writeVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridDhtAtomicUpdateRequest.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        cleanup();
-    }
-
-    /**
-     * Cleanup values not needed after message was sent.
-     */
-    private void cleanup() {
-        nearVals = null;
-        prevVals = null;
-
-        // Do not keep values if they are not needed for continuous query notification.
-        if (locPrevVals == null) {
-            keys = null;
-            vals = null;
-            locPrevVals = null;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 38;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 25;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtAtomicUpdateRequest.class, this, "super", super.toString());
-    }
-}


[07/51] [abbrv] ignite git commit: Merge branch 'master' into ignite-2523

Posted by vo...@apache.org.
Merge branch 'master' into ignite-2523


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

Branch: refs/heads/ignite-2523
Commit: e066650cf4907851dca1d8ef0297f6a1522d6a87
Parents: 07c2393 e7de923
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 15:02:52 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 15:02:52 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheEntry.java     |   9 +-
 .../continuous/CacheContinuousQueryHandler.java |   9 +
 ...ntinuousQueryPartitionAtomicOneNodeTest.java |  37 ++++
 ...heContinuousQueryPartitionTxOneNodeTest.java |  37 ++++
 ...tinuousQueryReplicatedAtomicOneNodeTest.java |  31 +++
 ...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 ------------
 ...eContinuousQueryReplicatedTxOneNodeTest.java | 193 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |  10 +-
 8 files changed, 321 insertions(+), 125 deletions(-)
----------------------------------------------------------------------



[46/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
deleted file mode 100644
index 60193ba..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
-
-/**
- * Lite DHT cache update request sent from near node to primary node.
- */
-public class GridNearAtomicUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Target node ID. */
-    @GridDirectTransient
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Fast map flag. */
-    private boolean fastMap;
-
-    /** Update version. Set to non-null if fastMap is {@code true}. */
-    private GridCacheVersion updateVer;
-
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
-    /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
-    private boolean topLocked;
-
-    /** Write synchronization mode. */
-    private CacheWriteSynchronizationMode syncMode;
-
-    /** Update operation. */
-    private GridCacheOperation op;
-
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Optional arguments for entry processor. */
-    @GridDirectTransient
-    private Object[] invokeArgs;
-
-    /** Entry processor arguments bytes. */
-    private byte[][] invokeArgsBytes;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** Conflict TTLs. */
-    private GridLongList conflictTtls;
-
-    /** Conflict expire times. */
-    private GridLongList conflictExpireTimes;
-
-    /** Return value flag. */
-    private boolean retval;
-
-    /** Expiry policy. */
-    @GridDirectTransient
-    private ExpiryPolicy expiryPlc;
-
-    /** Expiry policy bytes. */
-    private byte[] expiryPlcBytes;
-
-    /** Filter. */
-    private CacheEntryPredicate[] filter;
-
-    /** Flag indicating whether request contains primary keys. */
-    private boolean hasPrimary;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /** Task name hash. */
-    private int taskNameHash;
-
-    /** Skip write-through to a persistent storage. */
-    private boolean skipStore;
-
-    /** */
-    private boolean clientReq;
-
-    /** Keep binary flag. */
-    private boolean keepBinary;
-
-    /** */
-    @GridDirectTransient
-    private GridNearAtomicUpdateResponseInterface res;
-
-    /** Maximum possible size of inner collections. */
-    @GridDirectTransient
-    private int initSize;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridNearAtomicUpdateRequest() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID.
-     * @param futVer Future version.
-     * @param fastMap Fast map scheme flag.
-     * @param updateVer Update version set if fast map is performed.
-     * @param topVer Topology version.
-     * @param topLocked Topology locked flag.
-     * @param syncMode Synchronization mode.
-     * @param op Cache update operation.
-     * @param retval Return value required flag.
-     * @param expiryPlc Expiry policy.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param filter Optional filter for atomic check.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param skipStore Skip write-through to a persistent storage.
-     * @param keepBinary Keep binary flag.
-     * @param clientReq Client node request flag.
-     * @param addDepInfo Deployment info flag.
-     * @param maxEntryCnt Maximum entries count.
-     */
-    public GridNearAtomicUpdateRequest(
-        int cacheId,
-        UUID nodeId,
-        GridCacheVersion futVer,
-        boolean fastMap,
-        @Nullable GridCacheVersion updateVer,
-        @NotNull AffinityTopologyVersion topVer,
-        boolean topLocked,
-        CacheWriteSynchronizationMode syncMode,
-        GridCacheOperation op,
-        boolean retval,
-        @Nullable ExpiryPolicy expiryPlc,
-        @Nullable Object[] invokeArgs,
-        @Nullable CacheEntryPredicate[] filter,
-        @Nullable UUID subjId,
-        int taskNameHash,
-        boolean skipStore,
-        boolean keepBinary,
-        boolean clientReq,
-        boolean addDepInfo,
-        int maxEntryCnt
-    ) {
-        assert futVer != null;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.fastMap = fastMap;
-        this.updateVer = updateVer;
-
-        this.topVer = topVer;
-        this.topLocked = topLocked;
-        this.syncMode = syncMode;
-        this.op = op;
-        this.retval = retval;
-        this.expiryPlc = expiryPlc;
-        this.invokeArgs = invokeArgs;
-        this.filter = filter;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.skipStore = skipStore;
-        this.keepBinary = keepBinary;
-        this.clientReq = clientReq;
-        this.addDepInfo = addDepInfo;
-
-        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
-        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
-        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
-        // than 10, we use it.
-        initSize = Math.min(maxEntryCnt, 10);
-
-        keys = new ArrayList<>(initSize);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void nodeId(UUID nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID subjectId() {
-        return subjId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int taskNameHash() {
-        return taskNameHash;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean fastMap() {
-        return fastMap;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion updateVersion() {
-        return updateVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return topVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean topologyLocked() {
-        return topLocked;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clientRequest() {
-        return clientReq;
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return syncMode;
-    }
-
-    /** {@inheritDoc} */
-    @Override public ExpiryPolicy expiry() {
-        return expiryPlc;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean returnValue() {
-        return retval;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable public CacheEntryPredicate[] filter() {
-        return filter;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean skipStore() {
-        return skipStore;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean keepBinary() {
-        return keepBinary;
-    }
-
-    /**
-     * @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).
-     * @param primary If given key is primary on this mapping.
-     */
-    @SuppressWarnings("unchecked")
-    public void addUpdateEntry(KeyCacheObject key,
-        @Nullable Object val,
-        long conflictTtl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean primary) {
-        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;
-
-        keys.add(key);
-
-        if (entryProcessor != null) {
-            if (entryProcessors == null)
-                entryProcessors = new ArrayList<>(initSize);
-
-            entryProcessors.add(entryProcessor);
-        }
-        else if (val != null) {
-            assert val instanceof CacheObject : val;
-
-            if (vals == null)
-                vals = new ArrayList<>(initSize);
-
-            vals.add((CacheObject)val);
-        }
-
-        hasPrimary |= primary;
-
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>(initSize);
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (conflictTtl >= 0) {
-            if (conflictTtls == null) {
-                conflictTtls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictTtls.add(CU.TTL_NOT_CHANGED);
-            }
-
-            conflictTtls.add(conflictTtl);
-        }
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-
-            conflictExpireTimes.add(conflictExpireTime);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<KeyCacheObject> keys() {
-        return keys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<?> values() {
-        return op == TRANSFORM ? entryProcessors : vals;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheOperation operation() {
-        return op;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public Object[] invokeArguments() {
-        return invokeArgs;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public CacheObject value(int idx) {
-        assert op == UPDATE : op;
-
-        return vals.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
-        assert op == TRANSFORM : op;
-
-        return entryProcessors.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheObject writeValue(int idx) {
-        if (vals != null)
-            return vals.get(idx);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
-        return conflictVers;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictTtl(int idx) {
-        if (conflictTtls != null) {
-            assert idx >= 0 && idx < conflictTtls.size();
-
-            return conflictTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
-
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean hasPrimary() {
-        return hasPrimary;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
-        if (this.res == null) {
-            this.res = res;
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(keys, cctx);
-
-        if (filter != null) {
-            boolean hasFilter = false;
-
-            for (CacheEntryPredicate p : filter) {
-                if (p != null) {
-                    hasFilter = true;
-
-                    p.prepareMarshal(cctx);
-                }
-            }
-
-            if (!hasFilter)
-                filter = null;
-        }
-
-        if (expiryPlc != null && expiryPlcBytes == null)
-            expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
-
-        if (op == TRANSFORM) {
-            // force addition of deployment info for entry processors if P2P is enabled globally.
-            if (!addDepInfo && ctx.deploymentEnabled())
-                addDepInfo = true;
-
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
-            if (invokeArgsBytes == null)
-                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
-        }
-        else
-            prepareMarshalCacheObjects(vals, cctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
-
-        if (op == TRANSFORM) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
-            if (invokeArgs == null)
-                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
-        }
-        else
-            finishUnmarshalCacheObjects(vals, cctx, ldr);
-
-        if (filter != null) {
-            for (CacheEntryPredicate p : filter) {
-                if (p != null)
-                    p.finishUnmarshal(cctx, ldr);
-            }
-        }
-
-        if (expiryPlcBytes != null && expiryPlc == null)
-            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeBoolean("clientReq", clientReq))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("conflictTtls", conflictTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeBoolean("fastMap", fastMap))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeBoolean("hasPrimary", hasPrimary))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 14:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
-                    return false;
-
-                writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
-                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 17:
-                if (!writer.writeBoolean("retval", retval))
-                    return false;
-
-                writer.incrementState();
-
-            case 18:
-                if (!writer.writeBoolean("skipStore", skipStore))
-                    return false;
-
-                writer.incrementState();
-
-            case 19:
-                if (!writer.writeUuid("subjId", subjId))
-                    return false;
-
-                writer.incrementState();
-
-            case 20:
-                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 21:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
-                    return false;
-
-                writer.incrementState();
-
-            case 22:
-                if (!writer.writeBoolean("topLocked", topLocked))
-                    return false;
-
-                writer.incrementState();
-
-            case 23:
-                if (!writer.writeMessage("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 24:
-                if (!writer.writeMessage("updateVer", updateVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 25:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                clientReq = reader.readBoolean("clientReq");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                conflictTtls = reader.readMessage("conflictTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                fastMap = reader.readBoolean("fastMap");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                hasPrimary = reader.readBoolean("hasPrimary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 14:
-                keepBinary = reader.readBoolean("keepBinary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 15:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 16:
-                byte opOrd;
-
-                opOrd = reader.readByte("op");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                op = GridCacheOperation.fromOrdinal(opOrd);
-
-                reader.incrementState();
-
-            case 17:
-                retval = reader.readBoolean("retval");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 18:
-                skipStore = reader.readBoolean("skipStore");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 19:
-                subjId = reader.readUuid("subjId");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 20:
-                byte syncModeOrd;
-
-                syncModeOrd = reader.readByte("syncMode");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
-
-                reader.incrementState();
-
-            case 21:
-                taskNameHash = reader.readInt("taskNameHash");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 22:
-                topLocked = reader.readBoolean("topLocked");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 23:
-                topVer = reader.readMessage("topVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 24:
-                updateVer = reader.readMessage("updateVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 25:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridNearAtomicUpdateRequest.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void cleanup(boolean clearKeys) {
-        vals = null;
-        entryProcessors = null;
-        entryProcessorsBytes = null;
-        invokeArgs = null;
-        invokeArgsBytes = null;
-
-        if (clearKeys)
-            keys = null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 40;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 26;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
-            "parent", super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
deleted file mode 100644
index 84a4a9f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheReturn;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * DHT atomic cache near update response.
- */
-public class GridNearAtomicUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Cache message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Node ID this reply should be sent to. */
-    @GridDirectTransient
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Update error. */
-    @GridDirectTransient
-    private volatile IgniteCheckedException err;
-
-    /** Serialized error. */
-    private byte[] errBytes;
-
-    /** Return value. */
-    @GridToStringInclude
-    private GridCacheReturn ret;
-
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private volatile Collection<KeyCacheObject> failedKeys;
-
-    /** Keys that should be remapped. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> remapKeys;
-
-    /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearValsIdxs;
-
-    /** Indexes of keys for which update was skipped (used if originating node has near cache). */
-    @GridDirectCollection(int.class)
-    private List<Integer> nearSkipIdxs;
-
-    /** Values generated on primary node which should be put to originating node's near cache. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
-    /** Version generated on primary node to be used for originating node's near cache update. */
-    private GridCacheVersion nearVer;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridNearAtomicUpdateResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID this reply should be sent to.
-     * @param futVer Future version.
-     * @param addDepInfo Deployment info flag.
-     */
-    public GridNearAtomicUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer, boolean addDepInfo) {
-        assert futVer != null;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.addDepInfo = addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void nodeId(UUID nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void error(IgniteCheckedException err) {
-        this.err = err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteCheckedException error() {
-        return err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheReturn returnValue() {
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override @SuppressWarnings("unchecked")
-    public void returnValue(GridCacheReturn ret) {
-        this.ret = ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void remapKeys(List<KeyCacheObject> remapKeys) {
-        this.remapKeys = remapKeys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<KeyCacheObject> remapKeys() {
-        return remapKeys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addNearValue(int keyIdx,
-        @Nullable CacheObject val,
-        long ttl,
-        long expireTime) {
-        if (nearValsIdxs == null) {
-            nearValsIdxs = new ArrayList<>();
-            nearVals = new ArrayList<>();
-        }
-
-        addNearTtl(keyIdx, ttl, expireTime);
-
-        nearValsIdxs.add(keyIdx);
-        nearVals.add(val);
-    }
-
-    /** {@inheritDoc} */
-    @Override @SuppressWarnings("ForLoopReplaceableByForEach")
-    public void addNearTtl(int keyIdx, long ttl, long expireTime) {
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearTtls.add(-1L);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
-
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(16);
-
-                for (int i = 0; i < keyIdx; i++)
-                    nearExpireTimes.add(-1);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
-
-        return -1L;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
-
-        return -1L;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void nearVersion(GridCacheVersion nearVer) {
-        this.nearVer = nearVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion nearVersion() {
-        return nearVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addSkippedIndex(int keyIdx) {
-        if (nearSkipIdxs == null)
-            nearSkipIdxs = new ArrayList<>();
-
-        nearSkipIdxs.add(keyIdx);
-
-        addNearTtl(keyIdx, -1L, -1L);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public List<Integer> skippedIndexes() {
-        return nearSkipIdxs;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public List<Integer> nearValuesIndexes() {
-        return nearValsIdxs;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public CacheObject nearValue(int idx) {
-        return nearVals.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ConcurrentLinkedQueue<>();
-
-        failedKeys.add(key);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) {
-        if (keys != null) {
-            if (failedKeys == null)
-                failedKeys = new ArrayList<>(keys.size());
-
-            failedKeys.addAll(keys);
-        }
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e,
-        GridCacheContext ctx) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>(keys.size());
-
-        failedKeys.addAll(keys);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        if (err != null && errBytes == null)
-            errBytes = ctx.marshaller().marshal(err);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(failedKeys, cctx);
-
-        prepareMarshalCacheObjects(remapKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
-
-        if (ret != null)
-            ret.prepareMarshal(cctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(remapKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
-
-        if (ret != null)
-            ret.finishUnmarshal(cctx, ldr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeByteArray("errBytes", errBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, MessageCollectionItemType.INT))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeMessage("nearTtls", nearTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, MessageCollectionItemType.INT))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeMessage("nearVer", nearVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeCollection("remapKeys", remapKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeMessage("ret", ret))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                errBytes = reader.readByteArray("errBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                nearSkipIdxs = reader.readCollection("nearSkipIdxs", MessageCollectionItemType.INT);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                nearTtls = reader.readMessage("nearTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                nearValsIdxs = reader.readCollection("nearValsIdxs", MessageCollectionItemType.INT);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                nearVer = reader.readMessage("nearVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                remapKeys = reader.readCollection("remapKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                ret = reader.readMessage("ret");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridNearAtomicUpdateResponse.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 41;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 14;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearAtomicUpdateResponse.class, this, "parent");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index 5d5344e..55cd231 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -50,7 +50,7 @@ import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
@@ -816,7 +816,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
                         if (ccfg.getAtomicityMode() == ATOMIC)
                             checkOperationInProgressFails(client, ccfg, F.<Class<?>>asList(
-                                GridNearAtomicUpdateResponse.class, GridNearAtomicSingleUpdateResponse.class),
+                                GridNearAtomicMultipleUpdateResponse.class, GridNearAtomicSingleUpdateResponse.class),
                                 putOp);
                         else
                             checkOperationInProgressFails(client, ccfg, GridNearTxPrepareResponse.class, putOp);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index 22d56b0..4c011db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.IgniteClientDisconnectedException;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponseInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.testframework.GridTestUtils;
@@ -316,7 +316,7 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
         BlockTpcCommunicationSpi commSpi = commSpi(srv);
 
         if (colCfg.getAtomicityMode() == ATOMIC)
-            commSpi.blockMessage(GridNearAtomicUpdateResponse.class);
+            commSpi.blockMessage(GridNearAtomicMultipleUpdateResponse.class);
         else
             commSpi.blockMessage(GridNearTxPrepareResponse.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 358cc58..b56a8a6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -27,10 +27,10 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -139,9 +139,9 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
             TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
 
-            commSpi.registerMessage(GridNearAtomicUpdateRequest.class);
+            commSpi.registerMessage(GridNearAtomicMultipleUpdateRequest.class);
             commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
-            commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
+            commSpi.registerMessage(GridDhtAtomicMultipleUpdateRequest.class);
             commSpi.registerMessage(GridDhtAtomicSingleUpdateRequest.class);
 
             int putCnt = 15;
@@ -201,7 +201,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int nearRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridNearAtomicUpdateRequest.class) +
+        return commSpi.messageCount(GridNearAtomicMultipleUpdateRequest.class) +
             commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class);
     }
 
@@ -212,7 +212,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int dhtRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridDhtAtomicUpdateRequest.class) +
+        return commSpi.messageCount(GridDhtAtomicMultipleUpdateRequest.class) +
             commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index 024ff2f..43a111a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 
 /**
  * Stopped node when client operations are executing.
@@ -32,7 +32,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPut() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -40,7 +40,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPutBatch() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -48,7 +48,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPutAsync() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -56,7 +56,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testRemove() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 8ecef5d..4733e19 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -62,7 +62,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
@@ -233,10 +233,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
@@ -278,7 +278,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
             map.put(i, i + 1);
 
         // Block messages requests for single node.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
         putFut = GridTestUtils.runAsync(new Callable<Object>() {
@@ -366,16 +366,16 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite2.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite2.localNode().id());
 
-        spi.record(GridNearAtomicUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
+        spi.record(GridNearAtomicMultipleUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
 
         final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
 
@@ -469,10 +469,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1829f441/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index b6c89c7..0786b49 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -478,9 +478,9 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             Object origMsg = msg.message();
 
             return delay && (
-                (origMsg instanceof GridNearAtomicUpdateRequest) ||
+                (origMsg instanceof GridNearAtomicMultipleUpdateRequest) ||
                 (origMsg instanceof GridNearAtomicSingleUpdateRequest) ||
-                (origMsg instanceof GridDhtAtomicUpdateRequest) ||
+                (origMsg instanceof GridDhtAtomicMultipleUpdateRequest) ||
                 (origMsg instanceof GridDhtAtomicSingleUpdateRequest)
             );
         }


[39/51] [abbrv] ignite git commit: Merge branch 'ignite-2523' of https://github.com/ilantukh/ignite into ignite-2523-review

Posted by vo...@apache.org.
Merge branch 'ignite-2523' of https://github.com/ilantukh/ignite into ignite-2523-review


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

Branch: refs/heads/ignite-2523
Commit: 331c2197a6e519911633b007e4a9897617d0b227
Parents: 52e178f 6ce4d22
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:06:13 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:06:13 2016 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |   40 +-
 .../processors/cache/GridCacheAtomicFuture.java |    6 -
 .../processors/cache/GridCacheIoManager.java    |   71 +-
 .../processors/cache/GridCacheMessage.java      |   49 +
 .../dht/atomic/GridDhtAtomicCache.java          |   74 +-
 .../GridDhtAtomicMultipleUpdateRequest.java     | 1093 ++++++++++++++++++
 .../GridDhtAtomicMultipleUpdateResponse.java    |  298 +++++
 .../GridDhtAtomicSingleUpdateRequest.java       |  988 ++++++++++++++++
 .../GridDhtAtomicSingleUpdateResponse.java      |  284 +++++
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  113 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  966 ++--------------
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  278 +----
 .../GridNearAtomicMultipleUpdateRequest.java    |  989 ++++++++++++++++
 .../GridNearAtomicMultipleUpdateResponse.java   |  642 ++++++++++
 .../GridNearAtomicSingleUpdateRequest.java      |  899 ++++++++++++++
 .../GridNearAtomicSingleUpdateResponse.java     |  613 ++++++++++
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  192 +--
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  932 +--------------
 .../atomic/GridNearAtomicUpdateResponse.java    |  552 +--------
 .../distributed/near/GridNearAtomicCache.java   |   24 +-
 .../resources/META-INF/classnames.properties    |   12 +-
 .../IgniteClientReconnectAbstractTest.java      |    2 +-
 .../IgniteClientReconnectCacheTest.java         |   75 +-
 .../IgniteClientReconnectCollectionsTest.java   |    3 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |   51 +-
 .../IgniteCacheAtomicStopBusySelfTest.java      |   15 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   58 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    8 +-
 ...ContinuousQueryFailoverAbstractSelfTest.java |    5 +-
 29 files changed, 6582 insertions(+), 2750 deletions(-)
----------------------------------------------------------------------



[10/51] [abbrv] ignite git commit: IGNITE-2523: Fixed message count tests.

Posted by vo...@apache.org.
IGNITE-2523: Fixed message count tests.


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

Branch: refs/heads/ignite-2523
Commit: d3e1645aaeb8fd9393744cb087a9ddde27f2e95b
Parents: 3d34e50
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 4 10:52:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 4 10:52:48 2016 +0300

----------------------------------------------------------------------
 .../GridCacheAtomicMessageCountSelfTest.java    | 40 ++++++++++++++------
 1 file changed, 28 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d3e1645a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 0e17102..cda86ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -138,6 +139,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
             TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
 
             commSpi.registerMessage(GridNearAtomicUpdateRequest.class);
+            commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
             commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
 
             int putCnt = 15;
@@ -166,22 +168,22 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
                 jcache(0).put(i, i);
             }
 
-            assertEquals(expNearCnt, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
-            assertEquals(expDhtCnt, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
+            assertEquals(expNearCnt, nearRequestsCount(commSpi));
+            assertEquals(expDhtCnt, dhtRequestsCount(commSpi));
 
             if (writeOrderMode == CLOCK) {
                 for (int i = 1; i < 4; i++) {
                     commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
 
-                    assertEquals(0, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
-                    assertEquals(0, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
+                    assertEquals(0, nearRequestsCount(commSpi));
+                    assertEquals(0, dhtRequestsCount(commSpi));
                 }
             }
             else {
                 for (int i = 1; i < 4; i++) {
                     commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
 
-                    assertEquals(0, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+                    assertEquals(0, nearRequestsCount(commSpi));
                 }
             }
         }
@@ -191,6 +193,27 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
     }
 
     /**
+     * Get amount of near update requests.
+     *
+     * @param commSpi Communication SPI.
+     * @return Count.
+     */
+    private int nearRequestsCount(TestCommunicationSpi commSpi) {
+        return commSpi.messageCount(GridNearAtomicUpdateRequest.class) +
+            commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class);
+    }
+
+    /**
+     * Get amount of DHT update requests.
+     *
+     * @param commSpi Communication SPI.
+     * @return Count.
+     */
+    private int dhtRequestsCount(TestCommunicationSpi commSpi) {
+        return commSpi.messageCount(GridDhtAtomicUpdateRequest.class);
+    }
+
+    /**
      * Test communication SPI.
      */
     private static class TestCommunicationSpi extends TcpCommunicationSpi {
@@ -229,12 +252,5 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
             return cntr == null ? 0 : cntr.get();
         }
-
-        /**
-         * Resets counter to zero.
-         */
-        public void resetCount() {
-            cntMap.clear();
-        }
     }
 }
\ No newline at end of file


[41/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
Review.


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

Branch: refs/heads/ignite-2523
Commit: c814ae3a421e6f2e6d8d754135d258777d65bfe5
Parents: 331c219
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:10:57 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:10:57 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          |  58 ++--
 .../GridDhtAtomicMultipleUpdateRequest.java     |   2 +-
 .../GridDhtAtomicMultipleUpdateResponse.java    |   2 +-
 .../GridDhtAtomicSingleUpdateRequest.java       |   2 +-
 .../GridDhtAtomicSingleUpdateResponse.java      |   2 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  28 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  | 271 -------------------
 .../GridDhtAtomicUpdateRequestInterface.java    | 271 +++++++++++++++++++
 .../dht/atomic/GridDhtAtomicUpdateResponse.java | 112 --------
 .../GridDhtAtomicUpdateResponseInterface.java   | 112 ++++++++
 .../GridNearAtomicMultipleUpdateRequest.java    |   8 +-
 .../GridNearAtomicMultipleUpdateResponse.java   |   2 +-
 .../GridNearAtomicSingleUpdateRequest.java      |   8 +-
 .../GridNearAtomicSingleUpdateResponse.java     |   2 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  38 +--
 .../dht/atomic/GridNearAtomicUpdateRequest.java | 207 --------------
 .../GridNearAtomicUpdateRequestInterface.java   | 207 ++++++++++++++
 .../atomic/GridNearAtomicUpdateResponse.java    | 211 ---------------
 .../GridNearAtomicUpdateResponseInterface.java  | 211 +++++++++++++++
 .../distributed/near/GridNearAtomicCache.java   |  16 +-
 .../IgniteClientReconnectCollectionsTest.java   |   4 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   4 +-
 22 files changed, 889 insertions(+), 889 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index d1423f9..6965a9c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -141,7 +141,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Integer.getInteger(IGNITE_ATOMIC_DEFERRED_ACK_TIMEOUT, 500);
 
     /** Update reply closure. */
-    private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
+    private CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> updateReplyClos;
 
     /** Pending  */
     private ConcurrentMap<UUID, DeferredResponseBuffer> pendingResponses = new ConcurrentHashMap8<>();
@@ -194,9 +194,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+        updateReplyClos = new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface>() {
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-            @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+            @Override public void apply(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponseInterface res) {
                 if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
                     assert req.writeSynchronizationMode() != FULL_ASYNC : req;
 
@@ -1331,8 +1331,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal(
         final UUID nodeId,
-        final GridNearAtomicUpdateRequest req,
-        final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+        final GridNearAtomicUpdateRequestInterface req,
+        final CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb
     ) {
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
@@ -1356,10 +1356,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     public void updateAllAsyncInternal0(
         UUID nodeId,
-        GridNearAtomicUpdateRequest req,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+        GridNearAtomicUpdateRequestInterface req,
+        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb
     ) {
-        GridNearAtomicUpdateResponse res;
+        GridNearAtomicUpdateResponseInterface res;
 
         if (req instanceof GridNearAtomicSingleUpdateRequest)
             res = new GridNearAtomicSingleUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
@@ -1588,12 +1588,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateBatchResult updateWithBatch(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res,
+        GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateResponseInterface res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2004,12 +2004,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     private UpdateSingleResult updateSingle(
         ClusterNode node,
         boolean hasNear,
-        GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res,
+        GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateResponseInterface res,
         List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
         boolean replicate,
         String taskName,
         @Nullable IgniteCacheExpiryPolicy expiry,
@@ -2266,9 +2266,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         @Nullable Collection<KeyCacheObject> rmvKeys,
         @Nullable Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
         @Nullable GridDhtAtomicUpdateFuture dhtFut,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
-        final GridNearAtomicUpdateRequest req,
-        final GridNearAtomicUpdateResponse res,
+        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
+        final GridNearAtomicUpdateRequestInterface req,
+        final GridNearAtomicUpdateResponseInterface res,
         boolean replicate,
         UpdateBatchResult batchRes,
         String taskName,
@@ -2658,8 +2658,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      *      will return false.
      * @return {@code True} if filter evaluation succeeded.
      */
-    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
-        GridNearAtomicUpdateResponse res) {
+    private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequestInterface req,
+        GridNearAtomicUpdateResponseInterface res) {
         try {
             return ctx.isAllLocked(entry, req.filter());
         }
@@ -2673,7 +2673,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /**
      * @param req Request to remap.
      */
-    private void remapToNewPrimary(GridNearAtomicUpdateRequest req) {
+    private void remapToNewPrimary(GridNearAtomicUpdateRequestInterface req) {
         assert req.writeSynchronizationMode() == FULL_ASYNC : req;
 
         if (log.isDebugEnabled())
@@ -2752,9 +2752,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      */
     @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequest updateReq,
-        GridNearAtomicUpdateResponse updateRes,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        GridNearAtomicUpdateRequestInterface updateReq,
+        GridNearAtomicUpdateResponseInterface updateRes,
+        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
         boolean force
     ) {
         if (!force) {
@@ -2785,7 +2785,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Sender node ID.
      * @param req Near atomic update request.
      */
-    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequest req) {
+    private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
 
@@ -2799,7 +2799,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param res Near atomic update response.
      */
     @SuppressWarnings("unchecked")
-    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponse res) {
+    private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponseInterface res) {
         if (log.isDebugEnabled())
             log.debug("Processing near atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
 
@@ -2818,14 +2818,14 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Sender node ID.
      * @param req Dht atomic update request.
      */
-    private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+    private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequestInterface req) {
         if (log.isDebugEnabled())
             log.debug("Processing dht atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
 
         GridCacheVersion ver = req.writeVersion();
 
         // Always send update reply.
-        GridDhtAtomicUpdateResponse res;
+        GridDhtAtomicUpdateResponseInterface res;
 
         if (req instanceof GridDhtAtomicSingleUpdateRequest)
             res = new GridDhtAtomicSingleUpdateResponse(ctx.cacheId(), req.futureVersion(),
@@ -2999,7 +2999,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param res Dht atomic update response.
      */
     @SuppressWarnings("unchecked")
-    private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponse res) {
+    private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponseInterface res) {
         if (log.isDebugEnabled())
             log.debug("Processing dht atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
 
@@ -3036,7 +3036,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param nodeId Originating node ID.
      * @param res Near update response.
      */
-    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) {
+    private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponseInterface res) {
         try {
             ctx.io().send(nodeId, (GridCacheMessage)res, ctx.ioPolicy());
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
index 8a0cc69..2fb5065 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
@@ -49,7 +49,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Lite dht cache backup update request.
  */
-public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
+public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
index 5d26610..1c599c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
@@ -41,7 +41,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 /**
  * DHT atomic cache backup update response.
  */
-public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
+public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 2b29df6..a2ed9b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -43,7 +43,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.UUID;
 
-public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
+public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequestInterface {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index fc5a8b2..488bf7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -35,7 +35,7 @@ import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.Collections;
 
-public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
+public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponseInterface {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index df50542..6e2ed31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -79,20 +79,20 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
 
     /** Completion callback. */
     @GridToStringExclude
-    private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
+    private final CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb;
 
     /** Mappings. */
     @GridToStringInclude
-    private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
+    private final Map<UUID, GridDhtAtomicUpdateRequestInterface> mappings;
 
     /** Entries with readers. */
     private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
 
     /** Update request. */
-    private final GridNearAtomicUpdateRequest updateReq;
+    private final GridNearAtomicUpdateRequestInterface updateReq;
 
     /** Update response. */
-    private final GridNearAtomicUpdateResponse updateRes;
+    private final GridNearAtomicUpdateResponseInterface updateRes;
 
     /** Future keys. */
     private final Collection<KeyCacheObject> keys;
@@ -115,10 +115,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public GridDhtAtomicUpdateFuture(
         GridCacheContext cctx,
-        CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+        CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface> completionCb,
         GridCacheVersion writeVer,
-        GridNearAtomicUpdateRequest updateReq,
-        GridNearAtomicUpdateResponse updateRes
+        GridNearAtomicUpdateRequestInterface updateReq,
+        GridNearAtomicUpdateResponseInterface updateRes
     ) {
         this.cctx = cctx;
         this.writeVer = writeVer;
@@ -171,7 +171,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
     private boolean registerResponse(UUID nodeId) {
         int resCnt0;
 
-        GridDhtAtomicUpdateRequest req = mappings.get(nodeId);
+        GridDhtAtomicUpdateRequestInterface req = mappings.get(nodeId);
 
         if (req != null) {
             synchronized (this) {
@@ -248,7 +248,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
             UUID nodeId = node.id();
 
             if (!nodeId.equals(cctx.localNodeId())) {
-                GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+                GridDhtAtomicUpdateRequestInterface updateReq = mappings.get(nodeId);
 
                 if (updateReq == null) {
                     if (this.updateReq instanceof GridNearAtomicSingleUpdateRequest)
@@ -338,7 +338,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
         AffinityTopologyVersion topVer = updateReq.topologyVersion();
 
         for (UUID nodeId : readers) {
-            GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+            GridDhtAtomicUpdateRequestInterface updateReq = mappings.get(nodeId);
 
             if (updateReq == null) {
                 ClusterNode node = cctx.discovery().node(nodeId);
@@ -402,7 +402,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                     Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
 
                     exit:
-                    for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+                    for (GridDhtAtomicUpdateRequestInterface req : mappings.values()) {
                         for (int i = 0; i < req.size(); i++) {
                             KeyCacheObject key = req.key(i);
 
@@ -432,7 +432,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                 if (lsnrs != null) {
                     Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
 
-                    exit: for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+                    exit: for (GridDhtAtomicUpdateRequestInterface req : mappings.values()) {
                         for (int i = 0; i < req.size(); i++) {
                             KeyCacheObject key = req.key(i);
 
@@ -480,7 +480,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      */
     public void map() {
         if (!mappings.isEmpty()) {
-            for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+            for (GridDhtAtomicUpdateRequestInterface req : mappings.values()) {
                 try {
                     if (log.isDebugEnabled())
                         log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
@@ -516,7 +516,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
      * @param nodeId Backup node ID.
      * @param updateRes Update response.
      */
-    public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
+    public void onResult(UUID nodeId, GridDhtAtomicUpdateResponseInterface updateRes) {
         if (log.isDebugEnabled())
             log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
deleted file mode 100644
index 3e97462..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-import javax.cache.processor.EntryProcessor;
-import java.util.Collection;
-import java.util.UUID;
-
-/**
- * Base interface for DHT atomic update requests.
- */
-public interface GridDhtAtomicUpdateRequest extends Message {
-
-    /**
-     * @return Force transform backups flag.
-     */
-    boolean forceTransformBackups();
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL (optional).
-     * @param conflictExpireTime Conflict expire time (optional).
-     * @param conflictVer Conflict version (optional).
-     * @param addPrevVal If {@code true} adds previous value.
-     * @param prevVal Previous value.
-     */
-    void addWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean addPrevVal,
-        int partId,
-        @Nullable CacheObject prevVal,
-        @Nullable Long updateIdx,
-        boolean storeLocPrevVal);
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL.
-     * @param expireTime Expire time.
-     */
-    void addNearWriteValue(KeyCacheObject key,
-        @Nullable CacheObject val,
-        EntryProcessor<Object, Object, Object> entryProcessor,
-        long ttl,
-        long expireTime);
-
-    /**
-     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
-     *
-     * @return Message lookup index.
-     */
-    int lookupIndex();
-
-    /**
-     * @return Node ID.
-     */
-    UUID nodeId();
-
-    /**
-     * @return Subject ID.
-     */
-    UUID subjectId();
-
-    /**
-     * @return Task name.
-     */
-    int taskNameHash();
-
-    /**
-     * @return Keys size.
-     */
-    int size();
-
-    /**
-     * @return Keys size.
-     */
-    int nearSize();
-
-    /**
-     * @return Version assigned on primary node.
-     */
-    GridCacheVersion futureVersion();
-
-    /**
-     * @return Write version.
-     */
-    GridCacheVersion writeVersion();
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    CacheWriteSynchronizationMode writeSynchronizationMode();
-
-    /**
-     * @return Topology version.
-     */
-    AffinityTopologyVersion topologyVersion();
-
-    /**
-     * @return Keys.
-     */
-    Collection<KeyCacheObject> keys();
-
-    /**
-     * @param idx Key index.
-     * @return Key.
-     */
-    KeyCacheObject key(int idx);
-
-    /**
-     * @param idx Partition index.
-     * @return Partition id.
-     */
-    int partitionId(int idx);
-
-    /**
-     * @param updCntr Update counter.
-     * @return Update counter.
-     */
-    Long updateCounter(int updCntr);
-
-    /**
-     * @param idx Near key index.
-     * @return Key.
-     */
-    KeyCacheObject nearKey(int idx);
-
-    /**
-     * @return Keep binary flag.
-     */
-    boolean keepBinary();
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable CacheObject value(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable CacheObject previousValue(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable CacheObject localPreviousValue(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    @Nullable EntryProcessor<Object, Object, Object> entryProcessor(int idx);
-
-    /**
-     * @param idx Near key index.
-     * @return Value.
-     */
-    @Nullable CacheObject nearValue(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Transform closure.
-     */
-    @Nullable EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable GridCacheVersion conflictVersion(int idx);
-
-    /**
-     * @param idx Index.
-     * @return TTL.
-     */
-    long ttl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    long nearTtl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    long conflictExpireTime(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    long nearExpireTime(int idx);
-
-    /**
-     * @return {@code True} if on response flag changed.
-     */
-    boolean onResponse();
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable Object[] invokeArguments();
-
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
-
-    /**
-     * This method is called after the message is deserialized and is responsible for
-     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
-
-    /**
-     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
-     *
-     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
-     */
-    boolean addDeploymentInfo();
-
-    /**
-     * @return Error.
-     */
-    IgniteCheckedException classError();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java
new file mode 100644
index 0000000..43e6698
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequestInterface.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+import javax.cache.processor.EntryProcessor;
+import java.util.Collection;
+import java.util.UUID;
+
+/**
+ * Base interface for DHT atomic update requests.
+ */
+public interface GridDhtAtomicUpdateRequestInterface extends Message {
+
+    /**
+     * @return Force transform backups flag.
+     */
+    boolean forceTransformBackups();
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
+     * @param addPrevVal If {@code true} adds previous value.
+     * @param prevVal Previous value.
+     */
+    void addWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean addPrevVal,
+        int partId,
+        @Nullable CacheObject prevVal,
+        @Nullable Long updateIdx,
+        boolean storeLocPrevVal);
+
+    /**
+     * @param key Key to add.
+     * @param val Value, {@code null} if should be removed.
+     * @param entryProcessor Entry processor.
+     * @param ttl TTL.
+     * @param expireTime Expire time.
+     */
+    void addNearWriteValue(KeyCacheObject key,
+        @Nullable CacheObject val,
+        EntryProcessor<Object, Object, Object> entryProcessor,
+        long ttl,
+        long expireTime);
+
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
+    int lookupIndex();
+
+    /**
+     * @return Node ID.
+     */
+    UUID nodeId();
+
+    /**
+     * @return Subject ID.
+     */
+    UUID subjectId();
+
+    /**
+     * @return Task name.
+     */
+    int taskNameHash();
+
+    /**
+     * @return Keys size.
+     */
+    int size();
+
+    /**
+     * @return Keys size.
+     */
+    int nearSize();
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    GridCacheVersion futureVersion();
+
+    /**
+     * @return Write version.
+     */
+    GridCacheVersion writeVersion();
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    CacheWriteSynchronizationMode writeSynchronizationMode();
+
+    /**
+     * @return Topology version.
+     */
+    AffinityTopologyVersion topologyVersion();
+
+    /**
+     * @return Keys.
+     */
+    Collection<KeyCacheObject> keys();
+
+    /**
+     * @param idx Key index.
+     * @return Key.
+     */
+    KeyCacheObject key(int idx);
+
+    /**
+     * @param idx Partition index.
+     * @return Partition id.
+     */
+    int partitionId(int idx);
+
+    /**
+     * @param updCntr Update counter.
+     * @return Update counter.
+     */
+    Long updateCounter(int updCntr);
+
+    /**
+     * @param idx Near key index.
+     * @return Key.
+     */
+    KeyCacheObject nearKey(int idx);
+
+    /**
+     * @return Keep binary flag.
+     */
+    boolean keepBinary();
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Nullable CacheObject value(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Nullable CacheObject previousValue(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    @Nullable CacheObject localPreviousValue(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    @Nullable EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+    /**
+     * @param idx Near key index.
+     * @return Value.
+     */
+    @Nullable CacheObject nearValue(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Transform closure.
+     */
+    @Nullable EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Nullable GridCacheVersion conflictVersion(int idx);
+
+    /**
+     * @param idx Index.
+     * @return TTL.
+     */
+    long ttl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return TTL for near cache update.
+     */
+    long nearTtl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    long conflictExpireTime(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Expire time for near cache update.
+     */
+    long nearExpireTime(int idx);
+
+    /**
+     * @return {@code True} if on response flag changed.
+     */
+    boolean onResponse();
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable Object[] invokeArguments();
+
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
+
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
+
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
+    boolean addDeploymentInfo();
+
+    /**
+     * @return Error.
+     */
+    IgniteCheckedException classError();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
deleted file mode 100644
index 6fa9c4f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import java.util.Collection;
-
-/**
- * Base interface for DHT atomic update responses.
- */
-public interface GridDhtAtomicUpdateResponse extends Message {
-
-    /**
-     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
-     *
-     * @return Message lookup index.
-     */
-    int lookupIndex();
-
-    /**
-     * @return Version assigned on primary node.
-     */
-    GridCacheVersion futureVersion();
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    void onError(IgniteCheckedException err);
-
-    /**
-     * @return Error, if any.
-     */
-    IgniteCheckedException error();
-
-    /**
-     * @return Failed keys.
-     */
-    Collection<KeyCacheObject> failedKeys();
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    void addFailedKey(KeyCacheObject key, Throwable e);
-
-    /**
-     * @return Evicted readers.
-     */
-    Collection<KeyCacheObject> nearEvicted();
-
-    /**
-     * Adds near evicted key..
-     *
-     * @param key Evicted key.
-     */
-    void addNearEvicted(KeyCacheObject key);
-
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
-
-    /**
-     * This method is called after the message is deserialized and is responsible for
-     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
-
-    /**
-     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
-     *
-     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
-     */
-    boolean addDeploymentInfo();
-
-    /**
-     * @return Message ID.
-     */
-    long messageId();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java
new file mode 100644
index 0000000..7defbf0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponseInterface.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import java.util.Collection;
+
+/**
+ * Base interface for DHT atomic update responses.
+ */
+public interface GridDhtAtomicUpdateResponseInterface extends Message {
+
+    /**
+     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
+     *
+     * @return Message lookup index.
+     */
+    int lookupIndex();
+
+    /**
+     * @return Version assigned on primary node.
+     */
+    GridCacheVersion futureVersion();
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    void onError(IgniteCheckedException err);
+
+    /**
+     * @return Error, if any.
+     */
+    IgniteCheckedException error();
+
+    /**
+     * @return Failed keys.
+     */
+    Collection<KeyCacheObject> failedKeys();
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    void addFailedKey(KeyCacheObject key, Throwable e);
+
+    /**
+     * @return Evicted readers.
+     */
+    Collection<KeyCacheObject> nearEvicted();
+
+    /**
+     * Adds near evicted key..
+     *
+     * @param key Evicted key.
+     */
+    void addNearEvicted(KeyCacheObject key);
+
+    /**
+     * This method is called before the whole message is serialized
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache context.
+     * @throws IgniteCheckedException If failed.
+     */
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
+
+    /**
+     * This method is called after the message is deserialized and is responsible for
+     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
+
+    /**
+     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
+     *
+     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
+     */
+    boolean addDeploymentInfo();
+
+    /**
+     * @return Message ID.
+     */
+    long messageId();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index d702202..d1c3654 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -59,7 +59,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -158,7 +158,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicUpdateResponse res;
+    private GridNearAtomicUpdateResponseInterface res;
 
     /** Maximum possible size of inner collections. */
     @GridDirectTransient
@@ -503,7 +503,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
         if (this.res == null) {
             this.res = res;
 
@@ -514,7 +514,7 @@ public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponse response() {
+    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
index cbab328..24e7c3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -47,7 +47,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * DHT atomic cache near update response.
  */
-public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
+public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/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 61889e3..ce086d2 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
@@ -58,7 +58,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
  * Lite DHT cache update request sent from near node to primary node.
  */
 public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
+    implements GridNearAtomicUpdateRequestInterface, GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -150,7 +150,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
     /** */
     @GridDirectTransient
-    private GridNearAtomicUpdateResponse res;
+    private GridNearAtomicUpdateResponseInterface res;
 
     /**
      * Empty constructor required by {@link Externalizable}.
@@ -428,7 +428,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+    @Override public boolean onResponse(GridNearAtomicUpdateResponseInterface res) {
         if (this.res == null) {
             this.res = res;
 
@@ -439,7 +439,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponse response() {
+    @Override @Nullable public GridNearAtomicUpdateResponseInterface response() {
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index c7e5c8e..075f477 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -41,7 +41,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
-public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
+public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponseInterface {
 
     /** */
     private static final long serialVersionUID = 0L;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/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 82a2a8c..de89d91 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
@@ -339,7 +339,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param res Update response.
      */
-    public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
+    public void onResult(UUID nodeId, GridNearAtomicUpdateResponseInterface res) {
         state.onResult(nodeId, res, false);
     }
 
@@ -349,7 +349,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param req Update request.
      * @param res Update response.
      */
-    private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+    private void updateNear(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponseInterface res) {
         assert nearEnabled;
 
         if (res.remapKeys() != null || !req.hasPrimary())
@@ -451,12 +451,12 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
      * @param nodeId Node ID.
      * @param req Request.
      */
-    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
+    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req,
-                        GridNearAtomicUpdateResponse res) {
+                new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface>() {
+                    @Override public void apply(GridNearAtomicUpdateRequestInterface req,
+                        GridNearAtomicUpdateResponseInterface res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -510,9 +510,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
 
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req,
-                        GridNearAtomicUpdateResponse res) {
+                new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponseInterface>() {
+                    @Override public void apply(GridNearAtomicUpdateRequestInterface req,
+                        GridNearAtomicUpdateResponseInterface res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -555,7 +555,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         private Collection<KeyCacheObject> remapKeys;
 
         /** Not null is operation is mapped to single node. */
-        private GridNearAtomicUpdateRequest singleReq;
+        private GridNearAtomicUpdateRequestInterface singleReq;
 
         /** Operation result. */
         private GridCacheReturn opRes;
@@ -571,10 +571,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeId Left node ID.
          */
         void onNodeLeft(UUID nodeId) {
-            GridNearAtomicUpdateResponse res = null;
+            GridNearAtomicUpdateResponseInterface res = null;
 
             synchronized (this) {
-                GridNearAtomicUpdateRequest req;
+                GridNearAtomicUpdateRequestInterface req;
 
                 if (singleReq != null)
                     req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
@@ -612,8 +612,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param nodeErr {@code True} if response was created on node failure.
          */
         @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"}) void onResult(UUID nodeId,
-            GridNearAtomicUpdateResponse res, boolean nodeErr) {
-            GridNearAtomicUpdateRequest req;
+            GridNearAtomicUpdateResponseInterface res, boolean nodeErr) {
+            GridNearAtomicUpdateRequestInterface req;
 
             AffinityTopologyVersion remapTopVer = null;
 
@@ -744,7 +744,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             if (rcvAll && nearEnabled) {
                 if (mappings != null) {
                     for (GridNearAtomicMultipleUpdateRequest req0 : mappings.values()) {
-                        GridNearAtomicUpdateResponse res0 = req0.response();
+                        GridNearAtomicUpdateResponseInterface res0 = req0.response();
 
                         assert res0 != null : req0;
 
@@ -817,9 +817,9 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param req Request.
          * @param e Error.
          */
-        void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
+        void onSendError(GridNearAtomicUpdateRequestInterface req, IgniteCheckedException e) {
             synchronized (this) {
-                GridNearAtomicUpdateResponse res;
+                GridNearAtomicUpdateResponseInterface res;
 
                 if (req instanceof GridNearAtomicSingleUpdateRequest)
                     res = new GridNearAtomicSingleUpdateResponse(cctx.cacheId(),
@@ -853,7 +853,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
             }
 
             Exception err = null;
-            GridNearAtomicUpdateRequest singleReq0 = null;
+            GridNearAtomicUpdateRequestInterface singleReq0 = null;
             Map<UUID, GridNearAtomicMultipleUpdateRequest> mappings0 = null;
 
             int size = keys.size();
@@ -1138,7 +1138,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @return Request.
          * @throws Exception If failed.
          */
-        private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
+        private GridNearAtomicUpdateRequestInterface mapSingleUpdate(AffinityTopologyVersion topVer,
             Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer)
             throws Exception {
             Object key = F.first(keys);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
deleted file mode 100644
index b2d847b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Base interface for near atomic update requests.
- */
-public interface GridNearAtomicUpdateRequest extends Message {
-    /**
-     * @return Message ID.
-     */
-    public long messageId();
-
-    /**
-     * @return Mapped node ID.
-     */
-    public UUID nodeId();
-
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId);
-
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId();
-
-    /**
-     * @return Task name hash.
-     */
-    public int taskNameHash();
-
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion();
-
-    /**
-     * @return Flag indicating whether this is fast-map udpate.
-     */
-    public boolean fastMap();
-
-    /**
-     * @return Update version for fast-map request.
-     */
-    public GridCacheVersion updateVersion();
-
-    /**
-     * @return Topology version.
-     */
-    public AffinityTopologyVersion topologyVersion();
-
-    /**
-     * @return Topology locked flag.
-     */
-    public boolean topologyLocked();
-
-    /**
-     * @return {@code True} if request sent from client node.
-     */
-    public boolean clientRequest();
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode();
-
-    /**
-     * @return Expiry policy.
-     */
-    public ExpiryPolicy expiry();
-
-    /**
-     * @return Return value flag.
-     */
-    public boolean returnValue();
-
-    /**
-     * @return Filter.
-     */
-    @Nullable public CacheEntryPredicate[] filter();
-
-    /**
-     * @return Skip write-through to a persistent storage.
-     */
-    public boolean skipStore();
-
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary();
-
-    /**
-     * @return Keys for this update request.
-     */
-    public List<KeyCacheObject> keys();
-
-    /**
-     * @return Values for this update request.
-     */
-    public List<?> values();
-
-    /**
-     * @return Update operation.
-     */
-    public GridCacheOperation operation();
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments();
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    public CacheObject value(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
-
-    /**
-     * @param idx Index to get.
-     * @return Write value - either value, or transform closure.
-     */
-    public CacheObject writeValue(int idx);
-
-    /**
-     * @return Conflict versions.
-     */
-    @Nullable public List<GridCacheVersion> conflictVersions();
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict TTL.
-     */
-    public long conflictTtl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx);
-
-    /**
-     * @return Flag indicating whether this request contains primary keys.
-     */
-    public boolean hasPrimary();
-
-    /**
-     * @param res Response.
-     * @return {@code True} if current response was {@code null}.
-     */
-    public boolean onResponse(GridNearAtomicUpdateResponse res);
-
-    /**
-     * @return Response.
-     */
-    @Nullable public GridNearAtomicUpdateResponse response();
-
-    /**
-     * Cleanup values.
-     *
-     * @param clearKeys If {@code true} clears keys.
-     */
-    void cleanup(boolean clearKeys);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
new file mode 100644
index 0000000..f0f511b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Base interface for near atomic update requests.
+ */
+public interface GridNearAtomicUpdateRequestInterface extends Message {
+    /**
+     * @return Message ID.
+     */
+    public long messageId();
+
+    /**
+     * @return Mapped node ID.
+     */
+    public UUID nodeId();
+
+    /**
+     * @param nodeId Node ID.
+     */
+    public void nodeId(UUID nodeId);
+
+    /**
+     * @return Subject ID.
+     */
+    public UUID subjectId();
+
+    /**
+     * @return Task name hash.
+     */
+    public int taskNameHash();
+
+    /**
+     * @return Future version.
+     */
+    public GridCacheVersion futureVersion();
+
+    /**
+     * @return Flag indicating whether this is fast-map udpate.
+     */
+    public boolean fastMap();
+
+    /**
+     * @return Update version for fast-map request.
+     */
+    public GridCacheVersion updateVersion();
+
+    /**
+     * @return Topology version.
+     */
+    public AffinityTopologyVersion topologyVersion();
+
+    /**
+     * @return Topology locked flag.
+     */
+    public boolean topologyLocked();
+
+    /**
+     * @return {@code True} if request sent from client node.
+     */
+    public boolean clientRequest();
+
+    /**
+     * @return Cache write synchronization mode.
+     */
+    public CacheWriteSynchronizationMode writeSynchronizationMode();
+
+    /**
+     * @return Expiry policy.
+     */
+    public ExpiryPolicy expiry();
+
+    /**
+     * @return Return value flag.
+     */
+    public boolean returnValue();
+
+    /**
+     * @return Filter.
+     */
+    @Nullable public CacheEntryPredicate[] filter();
+
+    /**
+     * @return Skip write-through to a persistent storage.
+     */
+    public boolean skipStore();
+
+    /**
+     * @return Keep binary flag.
+     */
+    public boolean keepBinary();
+
+    /**
+     * @return Keys for this update request.
+     */
+    public List<KeyCacheObject> keys();
+
+    /**
+     * @return Values for this update request.
+     */
+    public List<?> values();
+
+    /**
+     * @return Update operation.
+     */
+    public GridCacheOperation operation();
+
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable public Object[] invokeArguments();
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    public CacheObject value(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+    /**
+     * @param idx Index to get.
+     * @return Write value - either value, or transform closure.
+     */
+    public CacheObject writeValue(int idx);
+
+    /**
+     * @return Conflict versions.
+     */
+    @Nullable public List<GridCacheVersion> conflictVersions();
+
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Nullable public GridCacheVersion conflictVersion(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict TTL.
+     */
+    public long conflictTtl(int idx);
+
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    public long conflictExpireTime(int idx);
+
+    /**
+     * @return Flag indicating whether this request contains primary keys.
+     */
+    public boolean hasPrimary();
+
+    /**
+     * @param res Response.
+     * @return {@code True} if current response was {@code null}.
+     */
+    public boolean onResponse(GridNearAtomicUpdateResponseInterface res);
+
+    /**
+     * @return Response.
+     */
+    @Nullable public GridNearAtomicUpdateResponseInterface response();
+
+    /**
+     * Cleanup values.
+     *
+     * @param clearKeys If {@code true} clears keys.
+     */
+    void cleanup(boolean clearKeys);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c814ae3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
deleted file mode 100644
index 4c4e8c1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheReturn;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Base interface for near atomic update responses.
- */
-public interface GridNearAtomicUpdateResponse extends Message {
-
-    /**
-     * Gets message lookup index. See {@link GridCacheMessage#lookupIndex()}.
-     *
-     * @return Message lookup index.
-     */
-    int lookupIndex();
-
-    /**
-     * @return Mapped node ID.
-     */
-    UUID nodeId();
-
-    /**
-     * @param nodeId Node ID.
-     */
-    void nodeId(UUID nodeId);
-
-    /**
-     * @return Future version.
-     */
-    GridCacheVersion futureVersion();
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    void error(IgniteCheckedException err);
-
-    /**
-     * @return Error, if any.
-     */
-    IgniteCheckedException error();
-
-    /**
-     * @return Collection of failed keys.
-     */
-    Collection<KeyCacheObject> failedKeys();
-
-    /**
-     * @return Return value.
-     */
-    GridCacheReturn returnValue();
-
-    /**
-     * @param ret Return value.
-     */
-    @SuppressWarnings("unchecked") void returnValue(GridCacheReturn ret);
-
-    /**
-     * @param remapKeys Remap keys.
-     */
-    void remapKeys(List<KeyCacheObject> remapKeys);
-
-    /**
-     * @return Remap keys.
-     */
-    Collection<KeyCacheObject> remapKeys();
-
-    /**
-     * Adds value to be put in near cache on originating node.
-     *
-     * @param keyIdx Key index.
-     * @param val Value.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    void addNearValue(int keyIdx,
-        @Nullable CacheObject val,
-        long ttl,
-        long expireTime);
-
-    /**
-     * @param keyIdx Key index.
-     * @param ttl TTL for near cache update.
-     * @param expireTime Expire time for near cache update.
-     */
-    @SuppressWarnings("ForLoopReplaceableByForEach") void addNearTtl(int keyIdx, long ttl, long expireTime);
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    long nearExpireTime(int idx);
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    long nearTtl(int idx);
-
-    /**
-     * @param nearVer Version generated on primary node to be used for originating node's near cache update.
-     */
-    void nearVersion(GridCacheVersion nearVer);
-
-    /**
-     * @return Version generated on primary node to be used for originating node's near cache update.
-     */
-    GridCacheVersion nearVersion();
-
-    /**
-     * @param keyIdx Index of key for which update was skipped
-     */
-    void addSkippedIndex(int keyIdx);
-
-    /**
-     * @return Indexes of keys for which update was skipped
-     */
-    @Nullable List<Integer> skippedIndexes();
-
-    /**
-     * @return Indexes of keys for which values were generated on primary node.
-     */
-    @Nullable List<Integer> nearValuesIndexes();
-
-    /**
-     * @param idx Index.
-     * @return Value generated on primary node which should be put to originating node's near cache.
-     */
-    @Nullable CacheObject nearValue(int idx);
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    void addFailedKey(KeyCacheObject key, Throwable e);
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     */
-    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e);
-
-    /**
-     * Adds keys to collection of failed keys.
-     *
-     * @param keys Key to add.
-     * @param e Error cause.
-     * @param ctx Context.
-     */
-    void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e, GridCacheContext ctx);
-
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
-
-    /**
-     * This method is called after the message is deserialized and is responsible for
-     * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
-
-    /**
-     *  Deployment enabled flag indicates whether deployment info has to be added to this message.
-     *
-     * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise.
-     */
-    boolean addDeploymentInfo();
-}


[08/51] [abbrv] ignite git commit: IGNITE-2523: Finalization.

Posted by vo...@apache.org.
IGNITE-2523: Finalization.


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

Branch: refs/heads/ignite-2523
Commit: 3967130f54fa21d25e7e284ecabaf004b937b921
Parents: e066650
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 15:53:07 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 15:53:07 2016 +0300

----------------------------------------------------------------------
 .../GridNearAtomicSingleUpdateRequest.java      | 188 ++++++-------------
 .../dht/atomic/GridNearAtomicUpdateRequest.java | 186 ++++++------------
 .../GridNearAtomicUpdateRequestInterface.java   | 144 +++++++++++---
 3 files changed, 238 insertions(+), 280 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3967130f/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 9ef0b6c..fea67c0 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
@@ -270,229 +270,164 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         return CACHE_MSG_IDX;
     }
 
-    /**
-     * @return Mapped node ID.
-     */
-    public UUID nodeId() {
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
         return nodeId;
     }
 
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId) {
+    /** {@inheritDoc} */
+    @Override public void nodeId(UUID nodeId) {
         this.nodeId = nodeId;
     }
 
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId() {
+    /** {@inheritDoc} */
+    @Override public UUID subjectId() {
         return subjId;
     }
 
-    /**
-     * @return Task name hash.
-     */
-    public int taskNameHash() {
+    /** {@inheritDoc} */
+    @Override public int taskNameHash() {
         return taskNameHash;
     }
 
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion() {
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
         return futVer;
     }
 
-    /**
-     * @return Flag indicating whether this is fast-map udpate.
-     */
-    public boolean fastMap() {
+    /** {@inheritDoc} */
+    @Override public boolean fastMap() {
         return fastMap;
     }
 
-    /**
-     * @return Update version for fast-map request.
-     */
-    public GridCacheVersion updateVersion() {
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion updateVersion() {
         return updateVer;
     }
 
-    /**
-     * @return Topology version.
-     */
+    /** {@inheritDoc} */
     @Override public AffinityTopologyVersion topologyVersion() {
         return topVer;
     }
 
-    /**
-     * @return Topology locked flag.
-     */
-    public boolean topologyLocked() {
+    /** {@inheritDoc} */
+    @Override public boolean topologyLocked() {
         return topLocked;
     }
 
-    /**
-     * @return {@code True} if request sent from client node.
-     */
-    public boolean clientRequest() {
+    /** {@inheritDoc} */
+    @Override public boolean clientRequest() {
         return clientReq;
     }
 
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode() {
+    /** {@inheritDoc} */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
         return syncMode;
     }
 
-    /**
-     * @return Expiry policy.
-     */
-    public ExpiryPolicy expiry() {
+    /** {@inheritDoc} */
+    @Override public ExpiryPolicy expiry() {
         return expiryPlc;
     }
 
-    /**
-     * @return Return value flag.
-     */
-    public boolean returnValue() {
+    /** {@inheritDoc} */
+    @Override public boolean returnValue() {
         return retval;
     }
 
-    /**
-     * @return Filter.
-     */
-    @Nullable public CacheEntryPredicate[] filter() {
+    /** {@inheritDoc} */
+    @Override @Nullable public CacheEntryPredicate[] filter() {
         return filter;
     }
 
-    /**
-     * @return Skip write-through to a persistent storage.
-     */
-    public boolean skipStore() {
+    /** {@inheritDoc} */
+    @Override public boolean skipStore() {
         return skipStore;
     }
 
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary() {
+    /** {@inheritDoc} */
+    @Override public boolean keepBinary() {
         return keepBinary;
     }
 
-    /**
-     * @return Keys for this update request.
-     */
-    public List<KeyCacheObject> keys() {
+    /** {@inheritDoc} */
+    @Override public List<KeyCacheObject> keys() {
         return Collections.singletonList(key);
     }
 
-    /**
-     * @return Values for this update request.
-     */
-    public List<?> values() {
+    /** {@inheritDoc} */
+    @Override public List<?> values() {
         return Collections.singletonList(op == TRANSFORM ? entryProc : val);
     }
 
-    /**
-     * @return Update operation.
-     */
-    public GridCacheOperation operation() {
+    /** {@inheritDoc} */
+    @Override public GridCacheOperation operation() {
         return op;
     }
 
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments() {
+    /** {@inheritDoc} */
+    @Override @Nullable public Object[] invokeArguments() {
         return invokeArgs;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    public CacheObject value(int idx) {
+    @Override public CacheObject value(int idx) {
         assert idx == 0;
         assert op == UPDATE : op;
 
         return val;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
         assert idx == 0;
         assert op == TRANSFORM : op;
 
         return entryProc;
     }
 
-    /**
-     * @param idx Index to get.
-     * @return Write value - either value, or transform closure.
-     */
-    public CacheObject writeValue(int idx) {
+    /** {@inheritDoc} */
+    @Override public CacheObject writeValue(int idx) {
         assert idx == 0;
 
         return val;
     }
 
-    /**
-     * @return Conflict versions.
-     */
-    @Nullable public List<GridCacheVersion> conflictVersions() {
+    /** {@inheritDoc} */
+    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
         return conflictVer == null ? null : Collections.singletonList(conflictVer);
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx) {
+    /** {@inheritDoc} */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
         assert idx == 0;
 
         return conflictVer;
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict TTL.
-     */
-    public long conflictTtl(int idx) {
+    /** {@inheritDoc} */
+    @Override public long conflictTtl(int idx) {
         assert idx == 0;
 
         return conflictTtl;
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx) {
+    /** {@inheritDoc} */
+    @Override public long conflictExpireTime(int idx) {
         assert idx == 0;
 
         return conflictExpireTime;
     }
 
-    /**
-     * @return Flag indicating whether this request contains primary keys.
-     */
-    public boolean hasPrimary() {
+    /** {@inheritDoc} */
+    @Override public boolean hasPrimary() {
         return true;
     }
 
-    /**
-     * @param res Response.
-     * @return {@code True} if current response was {@code null}.
-     */
-    public boolean onResponse(GridNearAtomicUpdateResponse res) {
+    /** {@inheritDoc} */
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -502,15 +437,12 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         return false;
     }
 
-    /**
-     * @return Response.
-     */
-    @Nullable public GridNearAtomicUpdateResponse response() {
+    /** {@inheritDoc} */
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
         return res;
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
+    /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3967130f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 674a5be..a86622f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -253,115 +253,83 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         return CACHE_MSG_IDX;
     }
 
-    /**
-     * @return Mapped node ID.
-     */
-    public UUID nodeId() {
+    /** {@inheritDoc} */
+    @Override public UUID nodeId() {
         return nodeId;
     }
 
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId) {
+    /** {@inheritDoc} */
+    @Override public void nodeId(UUID nodeId) {
         this.nodeId = nodeId;
     }
 
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId() {
+    /** {@inheritDoc} */
+    @Override public UUID subjectId() {
         return subjId;
     }
 
-    /**
-     * @return Task name hash.
-     */
-    public int taskNameHash() {
+    /** {@inheritDoc} */
+    @Override public int taskNameHash() {
         return taskNameHash;
     }
 
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion() {
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion futureVersion() {
         return futVer;
     }
 
-    /**
-     * @return Flag indicating whether this is fast-map udpate.
-     */
-    public boolean fastMap() {
+    /** {@inheritDoc} */
+    @Override public boolean fastMap() {
         return fastMap;
     }
 
-    /**
-     * @return Update version for fast-map request.
-     */
-    public GridCacheVersion updateVersion() {
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion updateVersion() {
         return updateVer;
     }
 
-    /**
-     * @return Topology version.
-     */
+    /** {@inheritDoc} */
     @Override public AffinityTopologyVersion topologyVersion() {
         return topVer;
     }
 
-    /**
-     * @return Topology locked flag.
-     */
-    public boolean topologyLocked() {
+    /** {@inheritDoc} */
+    @Override public boolean topologyLocked() {
         return topLocked;
     }
 
-    /**
-     * @return {@code True} if request sent from client node.
-     */
-    public boolean clientRequest() {
+    /** {@inheritDoc} */
+    @Override public boolean clientRequest() {
         return clientReq;
     }
 
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode() {
+    /** {@inheritDoc} */
+    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
         return syncMode;
     }
 
-    /**
-     * @return Expiry policy.
-     */
-    public ExpiryPolicy expiry() {
+    /** {@inheritDoc} */
+    @Override public ExpiryPolicy expiry() {
         return expiryPlc;
     }
 
-    /**
-     * @return Return value flag.
-     */
-    public boolean returnValue() {
+    /** {@inheritDoc} */
+    @Override public boolean returnValue() {
         return retval;
     }
 
-    /**
-     * @return Filter.
-     */
+    /** {@inheritDoc} */
     @Nullable public CacheEntryPredicate[] filter() {
         return filter;
     }
 
-    /**
-     * @return Skip write-through to a persistent storage.
-     */
-    public boolean skipStore() {
+    /** {@inheritDoc} */
+    @Override public boolean skipStore() {
         return skipStore;
     }
 
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary() {
+    /** {@inheritDoc} */
+    @Override public boolean keepBinary() {
         return keepBinary;
     }
 
@@ -446,79 +414,57 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         }
     }
 
-    /**
-     * @return Keys for this update request.
-     */
-    public List<KeyCacheObject> keys() {
+    /** {@inheritDoc} */
+    @Override public List<KeyCacheObject> keys() {
         return keys;
     }
 
-    /**
-     * @return Values for this update request.
-     */
-    public List<?> values() {
+    /** {@inheritDoc} */
+    @Override public List<?> values() {
         return op == TRANSFORM ? entryProcessors : vals;
     }
 
-    /**
-     * @return Update operation.
-     */
-    public GridCacheOperation operation() {
+    /** {@inheritDoc} */
+    @Override public GridCacheOperation operation() {
         return op;
     }
 
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments() {
+    /** {@inheritDoc} */
+    @Override @Nullable public Object[] invokeArguments() {
         return invokeArgs;
     }
 
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    public CacheObject value(int idx) {
+    @Override public CacheObject value(int idx) {
         assert op == UPDATE : op;
 
         return vals.get(idx);
     }
 
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
         assert op == TRANSFORM : op;
 
         return entryProcessors.get(idx);
     }
 
-    /**
-     * @param idx Index to get.
-     * @return Write value - either value, or transform closure.
-     */
-    public CacheObject writeValue(int idx) {
+    /** {@inheritDoc} */
+    @Override public CacheObject writeValue(int idx) {
         if (vals != null)
             return vals.get(idx);
 
         return null;
     }
 
-    /**
-     * @return Conflict versions.
-     */
-    @Nullable public List<GridCacheVersion> conflictVersions() {
+    /** {@inheritDoc} */
+    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
         return conflictVers;
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx) {
+    /** {@inheritDoc} */
+    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
         if (conflictVers != null) {
             assert idx >= 0 && idx < conflictVers.size();
 
@@ -528,11 +474,8 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         return null;
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict TTL.
-     */
-    public long conflictTtl(int idx) {
+    /** {@inheritDoc} */
+    @Override public long conflictTtl(int idx) {
         if (conflictTtls != null) {
             assert idx >= 0 && idx < conflictTtls.size();
 
@@ -542,11 +485,8 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         return CU.TTL_NOT_CHANGED;
     }
 
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx) {
+    /** {@inheritDoc} */
+    @Override public long conflictExpireTime(int idx) {
         if (conflictExpireTimes != null) {
             assert idx >= 0 && idx < conflictExpireTimes.size();
 
@@ -556,18 +496,13 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         return CU.EXPIRE_TIME_CALCULATE;
     }
 
-    /**
-     * @return Flag indicating whether this request contains primary keys.
-     */
-    public boolean hasPrimary() {
+    /** {@inheritDoc} */
+    @Override public boolean hasPrimary() {
         return hasPrimary;
     }
 
-    /**
-     * @param res Response.
-     * @return {@code True} if current response was {@code null}.
-     */
-    public boolean onResponse(GridNearAtomicUpdateResponse res) {
+    /** {@inheritDoc} */
+    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
         if (this.res == null) {
             this.res = res;
 
@@ -577,15 +512,12 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         return false;
     }
 
-    /**
-     * @return Response.
-     */
-    @Nullable public GridNearAtomicUpdateResponse response() {
+    /** {@inheritDoc} */
+    @Override @Nullable public GridNearAtomicUpdateResponse response() {
         return res;
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
+    /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3967130f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
index 2ef4bae..8115f9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
@@ -35,17 +35,37 @@ import java.util.UUID;
  * Base interface for near atomic update interfaces.
  */
 public interface GridNearAtomicUpdateRequestInterface {
-    public List<KeyCacheObject> keys();
+    /**
+     * @return Message ID.
+     */
+    public long messageId();
 
-    public AffinityTopologyVersion topologyVersion();
+    /**
+     * @return Mapped node ID.
+     */
+    public UUID nodeId();
 
-    public GridCacheVersion futureVersion();
+    /**
+     * @param nodeId Node ID.
+     */
+    public void nodeId(UUID nodeId);
 
-    public boolean returnValue();
+    /**
+     * @return Subject ID.
+     */
+    public UUID subjectId();
 
+    /**
+     * @return Task name hash.
+     */
     public int taskNameHash();
 
     /**
+     * @return Future version.
+     */
+    public GridCacheVersion futureVersion();
+
+    /**
      * @return Flag indicating whether this is fast-map udpate.
      */
     public boolean fastMap();
@@ -55,51 +75,125 @@ public interface GridNearAtomicUpdateRequestInterface {
      */
     public GridCacheVersion updateVersion();
 
-    public boolean clientRequest();
+    /**
+     * @return Topology version.
+     */
+    public AffinityTopologyVersion topologyVersion();
 
+    /**
+     * @return Topology locked flag.
+     */
     public boolean topologyLocked();
 
-    public ExpiryPolicy expiry();
+    /**
+     * @return {@code True} if request sent from client node.
+     */
+    public boolean clientRequest();
 
-    public boolean skipStore();
+    /**
+     * @return Cache write synchronization mode.
+     */
+    public CacheWriteSynchronizationMode writeSynchronizationMode();
 
-    public GridCacheOperation operation();
+    /**
+     * @return Expiry policy.
+     */
+    public ExpiryPolicy expiry();
 
-    public CacheWriteSynchronizationMode writeSynchronizationMode();
+    /**
+     * @return Return value flag.
+     */
+    public boolean returnValue();
 
-    public UUID subjectId();
+    /**
+     * @return Filter.
+     */
+    @Nullable public CacheEntryPredicate[] filter();
 
-    @Nullable public Object[] invokeArguments();
+    /**
+     * @return Skip write-through to a persistent storage.
+     */
+    public boolean skipStore();
 
+    /**
+     * @return Keep binary flag.
+     */
     public boolean keepBinary();
 
-    @Nullable public CacheEntryPredicate[] filter();
+    /**
+     * @return Keys for this update request.
+     */
+    public List<KeyCacheObject> keys();
 
-    public UUID nodeId();
+    /**
+     * @return Values for this update request.
+     */
+    public List<?> values();
 
-    public void nodeId(UUID nodeId);
+    /**
+     * @return Update operation.
+     */
+    public GridCacheOperation operation();
 
-    public boolean hasPrimary();
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable public Object[] invokeArguments();
+
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    public CacheObject value(int idx);
+
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+    /**
+     * @param idx Index to get.
+     * @return Write value - either value, or transform closure.
+     */
+    public CacheObject writeValue(int idx);
 
+    /**
+     * @return Conflict versions.
+     */
     @Nullable public List<GridCacheVersion> conflictVersions();
 
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
     @Nullable public GridCacheVersion conflictVersion(int idx);
 
+    /**
+     * @param idx Index.
+     * @return Conflict TTL.
+     */
     public long conflictTtl(int idx);
 
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
     public long conflictExpireTime(int idx);
 
-    public List<?> values();
-
-    public CacheObject value(int idx);
-
-    public long messageId();
-
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+    /**
+     * @return Flag indicating whether this request contains primary keys.
+     */
+    public boolean hasPrimary();
 
-    public CacheObject writeValue(int idx);
+    /**
+     * @param res Response.
+     * @return {@code True} if current response was {@code null}.
+     */
+    public boolean onResponse(GridNearAtomicUpdateResponse res);
 
+    /**
+     * @return Response.
+     */
     @Nullable public GridNearAtomicUpdateResponse response();
-
-    public boolean onResponse(GridNearAtomicUpdateResponse res);
 }


[15/51] [abbrv] ignite git commit: IGNITE-2523: Renamings.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 08b29be..960add7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -17,960 +17,183 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
 import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import java.util.List;
+import java.util.UUID;
 
 /**
- * Lite DHT cache update request sent from near node to primary node.
+ * Base interface for near atomic update requests.
  */
-public class GridNearAtomicUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequestBase, GridCacheDeployable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Target node ID. */
-    @GridDirectTransient
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Fast map flag. */
-    private boolean fastMap;
-
-    /** Update version. Set to non-null if fastMap is {@code true}. */
-    private GridCacheVersion updateVer;
-
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
-    /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
-    private boolean topLocked;
-
-    /** Write synchronization mode. */
-    private CacheWriteSynchronizationMode syncMode;
-
-    /** Update operation. */
-    private GridCacheOperation op;
-
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Optional arguments for entry processor. */
-    @GridDirectTransient
-    private Object[] invokeArgs;
-
-    /** Entry processor arguments bytes. */
-    private byte[][] invokeArgsBytes;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** Conflict TTLs. */
-    private GridLongList conflictTtls;
-
-    /** Conflict expire times. */
-    private GridLongList conflictExpireTimes;
-
-    /** Return value flag. */
-    private boolean retval;
-
-    /** Expiry policy. */
-    @GridDirectTransient
-    private ExpiryPolicy expiryPlc;
-
-    /** Expiry policy bytes. */
-    private byte[] expiryPlcBytes;
-
-    /** Filter. */
-    private CacheEntryPredicate[] filter;
-
-    /** Flag indicating whether request contains primary keys. */
-    private boolean hasPrimary;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /** Task name hash. */
-    private int taskNameHash;
-
-    /** Skip write-through to a persistent storage. */
-    private boolean skipStore;
-
-    /** */
-    private boolean clientReq;
-
-    /** Keep binary flag. */
-    private boolean keepBinary;
-
-    /** */
-    @GridDirectTransient
-    private GridNearAtomicUpdateResponse res;
-
-    /** Maximum possible size of inner collections. */
-    @GridDirectTransient
-    private int initSize;
+public interface GridNearAtomicUpdateRequest {
+    /**
+     * @return Message ID.
+     */
+    public long messageId();
 
     /**
-     * Empty constructor required by {@link Externalizable}.
+     * @return Mapped node ID.
      */
-    public GridNearAtomicUpdateRequest() {
-        // No-op.
-    }
+    public UUID nodeId();
 
     /**
-     * Constructor.
-     *
-     * @param cacheId Cache ID.
      * @param nodeId Node ID.
-     * @param futVer Future version.
-     * @param fastMap Fast map scheme flag.
-     * @param updateVer Update version set if fast map is performed.
-     * @param topVer Topology version.
-     * @param topLocked Topology locked flag.
-     * @param syncMode Synchronization mode.
-     * @param op Cache update operation.
-     * @param retval Return value required flag.
-     * @param expiryPlc Expiry policy.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param filter Optional filter for atomic check.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param skipStore Skip write-through to a persistent storage.
-     * @param keepBinary Keep binary flag.
-     * @param clientReq Client node request flag.
-     * @param addDepInfo Deployment info flag.
-     * @param maxEntryCnt Maximum entries count.
      */
-    public GridNearAtomicUpdateRequest(
-        int cacheId,
-        UUID nodeId,
-        GridCacheVersion futVer,
-        boolean fastMap,
-        @Nullable GridCacheVersion updateVer,
-        @NotNull AffinityTopologyVersion topVer,
-        boolean topLocked,
-        CacheWriteSynchronizationMode syncMode,
-        GridCacheOperation op,
-        boolean retval,
-        @Nullable ExpiryPolicy expiryPlc,
-        @Nullable Object[] invokeArgs,
-        @Nullable CacheEntryPredicate[] filter,
-        @Nullable UUID subjId,
-        int taskNameHash,
-        boolean skipStore,
-        boolean keepBinary,
-        boolean clientReq,
-        boolean addDepInfo,
-        int maxEntryCnt
-    ) {
-        assert futVer != null;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.fastMap = fastMap;
-        this.updateVer = updateVer;
-
-        this.topVer = topVer;
-        this.topLocked = topLocked;
-        this.syncMode = syncMode;
-        this.op = op;
-        this.retval = retval;
-        this.expiryPlc = expiryPlc;
-        this.invokeArgs = invokeArgs;
-        this.filter = filter;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.skipStore = skipStore;
-        this.keepBinary = keepBinary;
-        this.clientReq = clientReq;
-        this.addDepInfo = addDepInfo;
-
-        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
-        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
-        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
-        // than 10, we use it.
-        initSize = Math.min(maxEntryCnt, 10);
-
-        keys = new ArrayList<>(initSize);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID nodeId() {
-        return nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void nodeId(UUID nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID subjectId() {
-        return subjId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int taskNameHash() {
-        return taskNameHash;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean fastMap() {
-        return fastMap;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion updateVersion() {
-        return updateVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return topVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean topologyLocked() {
-        return topLocked;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clientRequest() {
-        return clientReq;
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return syncMode;
-    }
-
-    /** {@inheritDoc} */
-    @Override public ExpiryPolicy expiry() {
-        return expiryPlc;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean returnValue() {
-        return retval;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable public CacheEntryPredicate[] filter() {
-        return filter;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean skipStore() {
-        return skipStore;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean keepBinary() {
-        return keepBinary;
-    }
+    public void nodeId(UUID nodeId);
 
     /**
-     * @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).
-     * @param primary If given key is primary on this mapping.
+     * @return Subject ID.
      */
-    @SuppressWarnings("unchecked")
-    public void addUpdateEntry(KeyCacheObject key,
-        @Nullable Object val,
-        long conflictTtl,
-        long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean primary) {
-        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;
-
-        keys.add(key);
-
-        if (entryProcessor != null) {
-            if (entryProcessors == null)
-                entryProcessors = new ArrayList<>(initSize);
-
-            entryProcessors.add(entryProcessor);
-        }
-        else if (val != null) {
-            assert val instanceof CacheObject : val;
-
-            if (vals == null)
-                vals = new ArrayList<>(initSize);
-
-            vals.add((CacheObject)val);
-        }
-
-        hasPrimary |= primary;
-
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>(initSize);
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (conflictTtl >= 0) {
-            if (conflictTtls == null) {
-                conflictTtls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictTtls.add(CU.TTL_NOT_CHANGED);
-            }
-
-            conflictTtls.add(conflictTtl);
-        }
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-
-            conflictExpireTimes.add(conflictExpireTime);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<KeyCacheObject> keys() {
-        return keys;
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<?> values() {
-        return op == TRANSFORM ? entryProcessors : vals;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheOperation operation() {
-        return op;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public Object[] invokeArguments() {
-        return invokeArgs;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public CacheObject value(int idx) {
-        assert op == UPDATE : op;
-
-        return vals.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
-        assert op == TRANSFORM : op;
-
-        return entryProcessors.get(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheObject writeValue(int idx) {
-        if (vals != null)
-            return vals.get(idx);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public List<GridCacheVersion> conflictVersions() {
-        return conflictVers;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictTtl(int idx) {
-        if (conflictTtls != null) {
-            assert idx >= 0 && idx < conflictTtls.size();
-
-            return conflictTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
-
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean hasPrimary() {
-        return hasPrimary;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
-        if (this.res == null) {
-            this.res = res;
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable public GridNearAtomicUpdateResponse response() {
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(keys, cctx);
-
-        if (filter != null) {
-            boolean hasFilter = false;
-
-            for (CacheEntryPredicate p : filter) {
-                if (p != null) {
-                    hasFilter = true;
-
-                    p.prepareMarshal(cctx);
-                }
-            }
-
-            if (!hasFilter)
-                filter = null;
-        }
-
-        if (expiryPlc != null && expiryPlcBytes == null)
-            expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
-
-        if (op == TRANSFORM) {
-            // force addition of deployment info for entry processors if P2P is enabled globally.
-            if (!addDepInfo && ctx.deploymentEnabled())
-                addDepInfo = true;
-
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
-            if (invokeArgsBytes == null)
-                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
-        }
-        else
-            prepareMarshalCacheObjects(vals, cctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
-
-        if (op == TRANSFORM) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
-            if (invokeArgs == null)
-                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
-        }
-        else
-            finishUnmarshalCacheObjects(vals, cctx, ldr);
-
-        if (filter != null) {
-            for (CacheEntryPredicate p : filter) {
-                if (p != null)
-                    p.finishUnmarshal(cctx, ldr);
-            }
-        }
-
-        if (expiryPlcBytes != null && expiryPlc == null)
-            expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, ldr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeBoolean("clientReq", clientReq))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("conflictTtls", conflictTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeBoolean("fastMap", fastMap))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeBoolean("hasPrimary", hasPrimary))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 14:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
-                    return false;
-
-                writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
-                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
-                    return false;
+    public UUID subjectId();
 
-                writer.incrementState();
-
-            case 17:
-                if (!writer.writeBoolean("retval", retval))
-                    return false;
-
-                writer.incrementState();
-
-            case 18:
-                if (!writer.writeBoolean("skipStore", skipStore))
-                    return false;
-
-                writer.incrementState();
-
-            case 19:
-                if (!writer.writeUuid("subjId", subjId))
-                    return false;
-
-                writer.incrementState();
-
-            case 20:
-                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 21:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
-                    return false;
-
-                writer.incrementState();
-
-            case 22:
-                if (!writer.writeBoolean("topLocked", topLocked))
-                    return false;
-
-                writer.incrementState();
-
-            case 23:
-                if (!writer.writeMessage("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 24:
-                if (!writer.writeMessage("updateVer", updateVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 25:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                clientReq = reader.readBoolean("clientReq");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                conflictTtls = reader.readMessage("conflictTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                fastMap = reader.readBoolean("fastMap");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                hasPrimary = reader.readBoolean("hasPrimary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 14:
-                keepBinary = reader.readBoolean("keepBinary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 15:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 16:
-                byte opOrd;
-
-                opOrd = reader.readByte("op");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                op = GridCacheOperation.fromOrdinal(opOrd);
-
-                reader.incrementState();
-
-            case 17:
-                retval = reader.readBoolean("retval");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 18:
-                skipStore = reader.readBoolean("skipStore");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 19:
-                subjId = reader.readUuid("subjId");
-
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @return Task name hash.
+     */
+    public int taskNameHash();
 
-                reader.incrementState();
+    /**
+     * @return Future version.
+     */
+    public GridCacheVersion futureVersion();
 
-            case 20:
-                byte syncModeOrd;
+    /**
+     * @return Flag indicating whether this is fast-map udpate.
+     */
+    public boolean fastMap();
 
-                syncModeOrd = reader.readByte("syncMode");
+    /**
+     * @return Update version for fast-map request.
+     */
+    public GridCacheVersion updateVersion();
 
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @return Topology version.
+     */
+    public AffinityTopologyVersion topologyVersion();
 
-                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+    /**
+     * @return Topology locked flag.
+     */
+    public boolean topologyLocked();
 
-                reader.incrementState();
+    /**
+     * @return {@code True} if request sent from client node.
+     */
+    public boolean clientRequest();
 
-            case 21:
-                taskNameHash = reader.readInt("taskNameHash");
+    /**
+     * @return Cache write synchronization mode.
+     */
+    public CacheWriteSynchronizationMode writeSynchronizationMode();
 
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @return Expiry policy.
+     */
+    public ExpiryPolicy expiry();
 
-                reader.incrementState();
+    /**
+     * @return Return value flag.
+     */
+    public boolean returnValue();
 
-            case 22:
-                topLocked = reader.readBoolean("topLocked");
+    /**
+     * @return Filter.
+     */
+    @Nullable public CacheEntryPredicate[] filter();
 
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @return Skip write-through to a persistent storage.
+     */
+    public boolean skipStore();
 
-                reader.incrementState();
+    /**
+     * @return Keep binary flag.
+     */
+    public boolean keepBinary();
 
-            case 23:
-                topVer = reader.readMessage("topVer");
+    /**
+     * @return Keys for this update request.
+     */
+    public List<KeyCacheObject> keys();
 
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @return Values for this update request.
+     */
+    public List<?> values();
 
-                reader.incrementState();
+    /**
+     * @return Update operation.
+     */
+    public GridCacheOperation operation();
 
-            case 24:
-                updateVer = reader.readMessage("updateVer");
+    /**
+     * @return Optional arguments for entry processor.
+     */
+    @Nullable public Object[] invokeArguments();
 
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @param idx Key index.
+     * @return Value.
+     */
+    public CacheObject value(int idx);
 
-                reader.incrementState();
+    /**
+     * @param idx Key index.
+     * @return Entry processor.
+     */
+    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
 
-            case 25:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+    /**
+     * @param idx Index to get.
+     * @return Write value - either value, or transform closure.
+     */
+    public CacheObject writeValue(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    /**
+     * @return Conflict versions.
+     */
+    @Nullable public List<GridCacheVersion> conflictVersions();
 
-                reader.incrementState();
+    /**
+     * @param idx Index.
+     * @return Conflict version.
+     */
+    @Nullable public GridCacheVersion conflictVersion(int idx);
 
-        }
+    /**
+     * @param idx Index.
+     * @return Conflict TTL.
+     */
+    public long conflictTtl(int idx);
 
-        return reader.afterMessageRead(GridNearAtomicUpdateRequest.class);
-    }
+    /**
+     * @param idx Index.
+     * @return Conflict expire time.
+     */
+    public long conflictExpireTime(int idx);
 
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 40;
-    }
+    /**
+     * @return Flag indicating whether this request contains primary keys.
+     */
+    public boolean hasPrimary();
 
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 26;
-    }
+    /**
+     * @param res Response.
+     * @return {@code True} if current response was {@code null}.
+     */
+    public boolean onResponse(GridNearAtomicUpdateResponse res);
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
-            "parent", super.toString());
-    }
+    /**
+     * @return Response.
+     */
+    @Nullable public GridNearAtomicUpdateResponse response();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java
deleted file mode 100644
index 8ddb181..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestBase.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Base interface for near atomic update requests.
- */
-public interface GridNearAtomicUpdateRequestBase {
-    /**
-     * @return Message ID.
-     */
-    public long messageId();
-
-    /**
-     * @return Mapped node ID.
-     */
-    public UUID nodeId();
-
-    /**
-     * @param nodeId Node ID.
-     */
-    public void nodeId(UUID nodeId);
-
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId();
-
-    /**
-     * @return Task name hash.
-     */
-    public int taskNameHash();
-
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion();
-
-    /**
-     * @return Flag indicating whether this is fast-map udpate.
-     */
-    public boolean fastMap();
-
-    /**
-     * @return Update version for fast-map request.
-     */
-    public GridCacheVersion updateVersion();
-
-    /**
-     * @return Topology version.
-     */
-    public AffinityTopologyVersion topologyVersion();
-
-    /**
-     * @return Topology locked flag.
-     */
-    public boolean topologyLocked();
-
-    /**
-     * @return {@code True} if request sent from client node.
-     */
-    public boolean clientRequest();
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode();
-
-    /**
-     * @return Expiry policy.
-     */
-    public ExpiryPolicy expiry();
-
-    /**
-     * @return Return value flag.
-     */
-    public boolean returnValue();
-
-    /**
-     * @return Filter.
-     */
-    @Nullable public CacheEntryPredicate[] filter();
-
-    /**
-     * @return Skip write-through to a persistent storage.
-     */
-    public boolean skipStore();
-
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary();
-
-    /**
-     * @return Keys for this update request.
-     */
-    public List<KeyCacheObject> keys();
-
-    /**
-     * @return Values for this update request.
-     */
-    public List<?> values();
-
-    /**
-     * @return Update operation.
-     */
-    public GridCacheOperation operation();
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments();
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    public CacheObject value(int idx);
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
-
-    /**
-     * @param idx Index to get.
-     * @return Write value - either value, or transform closure.
-     */
-    public CacheObject writeValue(int idx);
-
-    /**
-     * @return Conflict versions.
-     */
-    @Nullable public List<GridCacheVersion> conflictVersions();
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict TTL.
-     */
-    public long conflictTtl(int idx);
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx);
-
-    /**
-     * @return Flag indicating whether this request contains primary keys.
-     */
-    public boolean hasPrimary();
-
-    /**
-     * @param res Response.
-     * @return {@code True} if current response was {@code null}.
-     */
-    public boolean onResponse(GridNearAtomicUpdateResponse res);
-
-    /**
-     * @return Response.
-     */
-    @Nullable public GridNearAtomicUpdateResponse response();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 22b9504..63c073d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -45,7 +45,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvali
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestBase;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
@@ -127,7 +127,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
      * @param res Update response.
      */
     public void processNearAtomicUpdateResponse(
-        GridNearAtomicUpdateRequestBase req,
+        GridNearAtomicUpdateRequest req,
         GridNearAtomicUpdateResponse res
     ) {
         if (F.size(res.failedKeys()) == req.keys().size())

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index cda86ba..50a6114 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -138,7 +138,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
             TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
 
-            commSpi.registerMessage(GridNearAtomicUpdateRequest.class);
+            commSpi.registerMessage(GridNearAtomicMultipleUpdateRequest.class);
             commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
             commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
 
@@ -199,7 +199,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int nearRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridNearAtomicUpdateRequest.class) +
+        return commSpi.messageCount(GridNearAtomicMultipleUpdateRequest.class) +
             commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index 024ff2f..43a111a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 
 /**
  * Stopped node when client operations are executing.
@@ -32,7 +32,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPut() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -40,7 +40,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPutBatch() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -48,7 +48,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testPutAsync() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();
@@ -56,7 +56,7 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
 
     /** {@inheritDoc} */
     @Override public void testRemove() throws Exception {
-        bannedMsg.set(GridNearAtomicUpdateRequest.class);
+        bannedMsg.set(GridNearAtomicMultipleUpdateRequest.class);
         bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
 
         super.testPut();

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 8182b33..49686fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -62,8 +62,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestBase;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -233,10 +233,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
@@ -278,7 +278,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
             map.put(i, i + 1);
 
         // Block messages requests for single node.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
         putFut = GridTestUtils.runAsync(new Callable<Object>() {
@@ -366,16 +366,16 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite2.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite2.localNode().id());
 
-        spi.record(GridNearAtomicUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
+        spi.record(GridNearAtomicMultipleUpdateRequest.class, GridNearAtomicSingleUpdateRequest.class);
 
         final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
 
@@ -412,7 +412,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         assertEquals(3, msgs.size());
 
         for (Object msg : msgs)
-            assertTrue(((GridNearAtomicUpdateRequestBase)msg).clientRequest());
+            assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());
 
         map.put(primaryKey(ignite0.cache(null)), 3);
         map.put(primaryKey(ignite1.cache(null)), 4);
@@ -469,10 +469,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
 
         // Block messages requests for both nodes.
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
-        spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicMultipleUpdateRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1491c1f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index c3bd369..0e7755b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -478,7 +478,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             Object origMsg = msg.message();
 
             return delay && (
-                (origMsg instanceof GridNearAtomicUpdateRequest) ||
+                (origMsg instanceof GridNearAtomicMultipleUpdateRequest) ||
                 (origMsg instanceof GridNearAtomicSingleUpdateRequest) ||
                 (origMsg instanceof GridDhtAtomicUpdateRequest)
             );


[03/51] [abbrv] ignite git commit: IGNITE-2532: Single update request is finalyl wired up. Though, it is not optimzied yet.

Posted by vo...@apache.org.
IGNITE-2532: Single update request is finalyl wired up. Though, it is not optimzied yet.


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

Branch: refs/heads/ignite-2523
Commit: 2a1a31d2d0999fdb8854a05fd7a75a4cd0b159a4
Parents: 29c2aee
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 11:36:39 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 11:36:39 2016 +0300

----------------------------------------------------------------------
 .../GridNearAbstractAtomicUpdateFuture.java     |   4 +
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 142 +++++++++++++------
 .../dht/atomic/GridNearAtomicUpdateRequest.java |   3 +-
 .../GridNearAtomicUpdateRequestInterface.java   |   4 +
 4 files changed, 107 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2a1a31d2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
index 60e0c5f..f8c6810 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAbstractAtomicUpdateFuture.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
@@ -53,6 +54,9 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
  */
 public abstract class GridNearAbstractAtomicUpdateFuture extends GridFutureAdapter<Object>
     implements GridCacheAtomicFuture<Object> {
+    /** */
+    public static final IgniteProductVersion SINGLE_PUT_MSG_SINCE = IgniteProductVersion.fromString("1.6.0");
+
     /** Logger reference. */
     protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2a1a31d2/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 2aa510d..493c765 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
@@ -108,7 +108,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     private Collection<KeyCacheObject> remapKeys;
 
     /** Not null is operation is mapped to single node. */
-    private GridNearAtomicUpdateRequest singleReq;
+    private GridNearAtomicUpdateRequestInterface singleReq;
 
     /** Operation result. */
     private GridCacheReturn opRes;    
@@ -195,7 +195,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
         GridNearAtomicUpdateResponse res = null;
 
         synchronized (this) {
-            GridNearAtomicUpdateRequest req;
+            GridNearAtomicUpdateRequestInterface req;
 
             if (singleReq != null)
                 req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
@@ -339,11 +339,11 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
      * @param nodeId Node ID.
      * @param req Request.
      */
-    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
+    private void mapSingle(UUID nodeId, GridNearAtomicUpdateRequestInterface req) {
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
-                new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+                new CI2<GridNearAtomicUpdateRequestInterface, GridNearAtomicUpdateResponse>() {
+                    @Override public void apply(GridNearAtomicUpdateRequestInterface req, GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -353,7 +353,13 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                 if (log.isDebugEnabled())
                     log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
 
-                cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+                if (req instanceof GridNearAtomicUpdateRequest)
+                    cctx.io().send(req.nodeId(), (GridNearAtomicUpdateRequest)req, cctx.ioPolicy());
+                else {
+                    assert req instanceof GridNearAtomicSingleUpdateRequest;
+
+                    cctx.io().send(req.nodeId(), (GridNearAtomicSingleUpdateRequest)req, cctx.ioPolicy());
+                }
 
                 if (syncMode == FULL_ASYNC)
                     onDone(new GridCacheReturn(cctx, true, true, null, true));
@@ -372,7 +378,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
     private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
         UUID locNodeId = cctx.localNodeId();
 
-        GridNearAtomicUpdateRequest locUpdate = null;
+        GridNearAtomicUpdateRequestInterface locUpdate = null;
 
         // Send messages to remote nodes first, then run local update.
         for (GridNearAtomicUpdateRequest req : mappings.values()) {
@@ -415,7 +421,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
      */
     @SuppressWarnings("unchecked")
     void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
-        GridNearAtomicUpdateRequest req;
+        GridNearAtomicUpdateRequestInterface req;
 
         AffinityTopologyVersion remapTopVer = null;
 
@@ -545,7 +551,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
 
         if (rcvAll && nearEnabled) {
             if (mappings != null) {
-                for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+                for (GridNearAtomicUpdateRequestInterface req0 : mappings.values()) {
                     GridNearAtomicUpdateResponse res0 = req0.response();
 
                     assert res0 != null : req0;
@@ -619,7 +625,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
      * @param req Request.
      * @param e Error.
      */
-    void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
+    void onSendError(GridNearAtomicUpdateRequestInterface req, IgniteCheckedException e) {
         synchronized (this) {
             GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
                 req.nodeId(),
@@ -647,7 +653,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
         }
 
         Exception err = null;
-        GridNearAtomicUpdateRequest singleReq0 = null;
+        GridNearAtomicUpdateRequestInterface singleReq0 = null;
         Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
 
         int size = keys.size();
@@ -674,7 +680,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             if (size == 1 && !fastMap) {
                 assert remapKeys == null || remapKeys.size() == 1;
 
-                singleReq0 = mapSingleUpdate(topVer, futVer, updVer);
+                singleReq0 = mapSingleUpdate(topVer, topNodes, futVer, updVer);
             }
             else {
                 Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
@@ -799,6 +805,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
      * @return Mapping.
      * @throws Exception If failed.
      */
+    @SuppressWarnings("ConstantConditions")
     private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
         AffinityTopologyVersion topVer,
         GridCacheVersion futVer,
@@ -926,14 +933,14 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
 
     /**
      * @param topVer Topology version.
+     * @param topNodes Topology nodes.
      * @param futVer Future version.
      * @param updVer Update version.
      * @return Request.
      * @throws Exception If failed.
      */
-    private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
-        GridCacheVersion futVer,
-        @Nullable GridCacheVersion updVer) throws Exception {
+    private GridNearAtomicUpdateRequestInterface mapSingleUpdate(AffinityTopologyVersion topVer,
+        Collection<ClusterNode> topNodes, GridCacheVersion futVer, @Nullable GridCacheVersion updVer) throws Exception {
         Object key = F.first(keys);
 
         Object val;
@@ -990,36 +997,81 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
             throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
                 "left the grid).");
 
-        GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
-            cctx.cacheId(),
-            primary.id(),
-            futVer,
-            fastMap,
-            updVer,
-            topVer,
-            topLocked,
-            syncMode,
-            op,
-            retval,
-            expiryPlc,
-            invokeArgs,
-            filter,
-            subjId,
-            taskNameHash,
-            skipStore,
-            keepBinary,
-            cctx.kernalContext().clientNode(),
-            cctx.deploymentEnabled(),
-            1);
-
-        req.addUpdateEntry(cacheKey,
-            val,
-            conflictTtl,
-            conflictExpireTime,
-            conflictVer,
-            true);
-
-        return req;
+        // Decide whether we will use optimzied version of update request.
+        boolean optimize = true;
+
+        for (ClusterNode topNode : topNodes) {
+            if (topNode.version().compareTo(SINGLE_PUT_MSG_SINCE) < 0) {
+                optimize = false;
+
+                break;
+            }
+        }
+
+        if (optimize) {
+            GridNearAtomicSingleUpdateRequest req = new GridNearAtomicSingleUpdateRequest(
+                cctx.cacheId(),
+                primary.id(),
+                futVer,
+                fastMap,
+                updVer,
+                topVer,
+                topLocked,
+                syncMode,
+                op,
+                retval,
+                expiryPlc,
+                invokeArgs,
+                filter,
+                subjId,
+                taskNameHash,
+                skipStore,
+                keepBinary,
+                cctx.kernalContext().clientNode(),
+                cctx.deploymentEnabled(),
+                1);
+
+            req.addUpdateEntry(cacheKey,
+                val,
+                conflictTtl,
+                conflictExpireTime,
+                conflictVer,
+                true);
+
+            return req;
+        }
+        else {
+            GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+                cctx.cacheId(),
+                primary.id(),
+                futVer,
+                fastMap,
+                updVer,
+                topVer,
+                topLocked,
+                syncMode,
+                op,
+                retval,
+                expiryPlc,
+                invokeArgs,
+                filter,
+                subjId,
+                taskNameHash,
+                skipStore,
+                keepBinary,
+                cctx.kernalContext().clientNode(),
+                cctx.deploymentEnabled(),
+                1);
+
+            req.addUpdateEntry(cacheKey,
+                val,
+                conflictTtl,
+                conflictExpireTime,
+                conflictVer,
+                true);
+
+            return req;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/2a1a31d2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 340dbf6..674a5be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -373,6 +373,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
      * @param conflictVer Conflict version (optional).
      * @param primary If given key is primary on this mapping.
      */
+    @SuppressWarnings("unchecked")
     public void addUpdateEntry(KeyCacheObject key,
         @Nullable Object val,
         long conflictTtl,
@@ -384,7 +385,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage
         if (op == TRANSFORM) {
             assert val instanceof EntryProcessor : val;
 
-            entryProcessor = (EntryProcessor<Object, Object, Object>) val;
+            entryProcessor = (EntryProcessor<Object, Object, Object>)val;
         }
 
         assert val != null || op == DELETE;

http://git-wip-us.apache.org/repos/asf/ignite/blob/2a1a31d2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
index 9f17756..2ef4bae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequestInterface.java
@@ -98,4 +98,8 @@ public interface GridNearAtomicUpdateRequestInterface {
     public EntryProcessor<Object, Object, Object> entryProcessor(int idx);
 
     public CacheObject writeValue(int idx);
+
+    @Nullable public GridNearAtomicUpdateResponse response();
+
+    public boolean onResponse(GridNearAtomicUpdateResponse res);
 }


[51/51] [abbrv] ignite git commit: Review.

Posted by vo...@apache.org.
Review.


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

Branch: refs/heads/ignite-2523
Commit: 8024566596002acf950aae5047f5c388bc5b256e
Parents: 0a04244
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 25 15:30:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 25 15:30:48 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 26 +++++++++++++-------
 .../GridDhtAtomicMultipleUpdateRequest.java     |  3 ++-
 .../GridDhtAtomicMultipleUpdateResponse.java    |  3 ++-
 .../GridDhtAtomicSingleUpdateRequest.java       |  3 ++-
 .../GridDhtAtomicSingleUpdateResponse.java      |  3 ++-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  3 +--
 .../GridNearAtomicMultipleUpdateRequest.java    |  4 +--
 .../GridNearAtomicMultipleUpdateResponse.java   |  3 ++-
 .../GridNearAtomicSingleUpdateRequest.java      |  4 +--
 .../GridNearAtomicSingleUpdateResponse.java     |  4 +--
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 12 +++------
 11 files changed, 38 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index d1423f9..a2e0540 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -252,49 +252,57 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateRequest.class, new CI2<UUID, GridNearAtomicMultipleUpdateRequest>() {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateRequest.class,
+            new CI2<UUID, GridNearAtomicMultipleUpdateRequest>() {
             @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateRequest req) {
                 processNearAtomicUpdateRequest(nodeId, req);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicSingleUpdateRequest.class, new CI2<UUID, GridNearAtomicSingleUpdateRequest>() {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicSingleUpdateRequest.class,
+            new CI2<UUID, GridNearAtomicSingleUpdateRequest>() {
             @Override public void apply(UUID nodeId, GridNearAtomicSingleUpdateRequest req) {
                 processNearAtomicUpdateRequest(nodeId, req);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateResponse.class, new CI2<UUID, GridNearAtomicMultipleUpdateResponse>() {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicMultipleUpdateResponse.class,
+            new CI2<UUID, GridNearAtomicMultipleUpdateResponse>() {
             @Override public void apply(UUID nodeId, GridNearAtomicMultipleUpdateResponse res) {
                 processNearAtomicUpdateResponse(nodeId, res);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicSingleUpdateResponse.class, new CI2<UUID, GridNearAtomicSingleUpdateResponse>() {
+        ctx.io().addHandler(ctx.cacheId(), GridNearAtomicSingleUpdateResponse.class,
+            new CI2<UUID, GridNearAtomicSingleUpdateResponse>() {
             @Override public void apply(UUID nodeId, GridNearAtomicSingleUpdateResponse res) {
                 processNearAtomicUpdateResponse(nodeId, res);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateRequest.class, new CI2<UUID, GridDhtAtomicMultipleUpdateRequest>() {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateRequest.class,
+            new CI2<UUID, GridDhtAtomicMultipleUpdateRequest>() {
             @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateRequest req) {
                 processDhtAtomicUpdateRequest(nodeId, req);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicSingleUpdateRequest.class, new CI2<UUID, GridDhtAtomicSingleUpdateRequest>() {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicSingleUpdateRequest.class,
+            new CI2<UUID, GridDhtAtomicSingleUpdateRequest>() {
             @Override public void apply(UUID nodeId, GridDhtAtomicSingleUpdateRequest req) {
                 processDhtAtomicUpdateRequest(nodeId, req);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateResponse.class, new CI2<UUID, GridDhtAtomicMultipleUpdateResponse>() {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicMultipleUpdateResponse.class,
+            new CI2<UUID, GridDhtAtomicMultipleUpdateResponse>() {
             @Override public void apply(UUID nodeId, GridDhtAtomicMultipleUpdateResponse res) {
                 processDhtAtomicUpdateResponse(nodeId, res);
             }
         });
 
-        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicSingleUpdateResponse.class, new CI2<UUID, GridDhtAtomicSingleUpdateResponse>() {
+        ctx.io().addHandler(ctx.cacheId(), GridDhtAtomicSingleUpdateResponse.class,
+            new CI2<UUID, GridDhtAtomicSingleUpdateResponse>() {
             @Override public void apply(UUID nodeId, GridDhtAtomicSingleUpdateResponse res) {
                 processDhtAtomicUpdateResponse(nodeId, res);
             }
@@ -1842,7 +1850,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             req.keepBinary());
 
                         Object val = ctx.config().getInterceptor().onBeforePut(new CacheLazyEntry(ctx, entry.key(),
-                                old, req.keepBinary()),
+                            old, req.keepBinary()),
                             updated.value(ctx.cacheObjectContext(), false));
 
                         if (val == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
index becec6e..f949bbd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateRequest.java
@@ -49,7 +49,8 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Lite dht cache backup update request.
  */
-public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
+public class GridDhtAtomicMultipleUpdateRequest extends GridCacheMessage implements GridCacheDeployable,
+    GridDhtAtomicUpdateRequest {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
index 6f11686..08106e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicMultipleUpdateResponse.java
@@ -41,7 +41,8 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 /**
  * DHT atomic cache backup update response.
  */
-public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
+public class GridDhtAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable,
+    GridDhtAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 2b29df6..58c3629 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -43,7 +43,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.UUID;
 
-public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateRequest {
+public class GridDhtAtomicSingleUpdateRequest extends GridCacheMessage implements GridCacheDeployable,
+    GridDhtAtomicUpdateRequest {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index fc5a8b2..57a5db1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -35,7 +35,8 @@ import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.Collections;
 
-public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
+public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable,
+    GridDhtAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index df50542..d0b7be3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -401,8 +401,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                 if (!mappings.isEmpty() && lsnrs != null) {
                     Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
 
-                    exit:
-                    for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+                    exit: for (GridDhtAtomicUpdateRequest req : mappings.values()) {
                         for (int i = 0; i < req.size(); i++) {
                             KeyCacheObject key = req.key(i);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
index d702202..341b4d0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateRequest.java
@@ -58,8 +58,8 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
 /**
  * Lite DHT cache update request sent from near node to primary node.
  */
-public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
+public class GridNearAtomicMultipleUpdateRequest extends GridCacheMessage implements GridNearAtomicUpdateRequest,
+    GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
index 7cb8886..fbab054 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicMultipleUpdateResponse.java
@@ -47,7 +47,8 @@ import org.jetbrains.annotations.Nullable;
 /**
  * DHT atomic cache near update response.
  */
-public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
+public class GridNearAtomicMultipleUpdateResponse extends GridCacheMessage implements GridCacheDeployable,
+    GridNearAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/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 61889e3..0d1553d 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
@@ -57,8 +57,8 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPD
 /**
  * Lite DHT cache update request sent from near node to primary node.
  */
-public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
-    implements GridNearAtomicUpdateRequest, GridCacheDeployable {
+public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage implements GridNearAtomicUpdateRequest,
+    GridCacheDeployable {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index c7e5c8e..3baeed8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -41,8 +41,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
-public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridNearAtomicUpdateResponse {
-
+public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable,
+    GridNearAtomicUpdateResponse {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80245665/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 82a2a8c..9c2dfd9 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
@@ -455,8 +455,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         if (cctx.localNodeId().equals(nodeId)) {
             cache.updateAllAsyncInternal(nodeId, req,
                 new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req,
-                        GridNearAtomicUpdateResponse res) {
+                    @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -511,8 +510,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         if (locUpdate != null) {
             cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
                 new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
-                    @Override public void apply(GridNearAtomicUpdateRequest req,
-                        GridNearAtomicUpdateResponse res) {
+                    @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
                         onResult(res.nodeId(), res);
                     }
                 });
@@ -611,8 +609,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
          * @param res Response.
          * @param nodeErr {@code True} if response was created on node failure.
          */
-        @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"}) void onResult(UUID nodeId,
-            GridNearAtomicUpdateResponse res, boolean nodeErr) {
+        @SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
+        void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
             GridNearAtomicUpdateRequest req;
 
             AffinityTopologyVersion remapTopVer = null;
@@ -1208,8 +1206,6 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                 }
             }
 
-            optimize = false;
-
             if (optimize) {
                 return new GridNearAtomicSingleUpdateRequest(
                     cacheKey,


[30/51] [abbrv] ignite git commit: ignite-2523 : GridDhtAtomicSingleUpdateResponse optimized implementation.

Posted by vo...@apache.org.
ignite-2523 : GridDhtAtomicSingleUpdateResponse optimized implementation.


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

Branch: refs/heads/ignite-2523
Commit: 1256485bd2b2ab6cb16b0778651584739747ba04
Parents: cd07298
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Feb 9 17:52:38 2016 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Tue Feb 9 17:52:38 2016 +0300

----------------------------------------------------------------------
 .../GridDhtAtomicSingleUpdateResponse.java      | 45 ++++++++------------
 1 file changed, 18 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1256485b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
index 6a69ccc..044efa9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -37,6 +37,7 @@ import java.io.Externalizable;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
@@ -49,10 +50,11 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
     /** Future version. */
     private GridCacheVersion futVer;
 
-    /** Failed keys. */
     @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> failedKeys;
+    private KeyCacheObject failedKey;
+
+    @GridToStringInclude
+    private KeyCacheObject nearEvicted;
 
     /** Update error. */
     @GridDirectTransient
@@ -61,11 +63,6 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
     /** Serialized update error. */
     private byte[] errBytes;
 
-    /** Evicted readers. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearEvicted;
-
     /**
      * Empty constructor required by {@link Externalizable}.
      */
@@ -114,7 +111,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
      * @return Failed keys.
      */
     @Override public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
+        return failedKey != null ? Collections.singletonList(failedKey) : null;
     }
 
     /**
@@ -124,10 +121,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
      * @param e Error cause.
      */
     @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>();
-
-        failedKeys.add(key);
+        failedKey = key;
 
         if (err == null)
             err = new IgniteCheckedException("Failed to update keys on primary node.");
@@ -139,7 +133,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
      * @return Evicted readers.
      */
     @Override public Collection<KeyCacheObject> nearEvicted() {
-        return nearEvicted;
+        return nearEvicted != null ? Collections.singletonList(nearEvicted) : null;
     }
 
     /**
@@ -148,10 +142,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
      * @param key Evicted key.
      */
     @Override public void addNearEvicted(KeyCacheObject key) {
-        if (nearEvicted == null)
-            nearEvicted = new ArrayList<>();
-
-        nearEvicted.add(key);
+        nearEvicted = key;
     }
 
     /** {@inheritDoc} */
@@ -160,9 +151,9 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 
-        prepareMarshalCacheObjects(failedKeys, cctx);
+        prepareMarshalCacheObject(failedKey, cctx);
 
-        prepareMarshalCacheObjects(nearEvicted, cctx);
+        prepareMarshalCacheObject(nearEvicted, cctx);
 
         if (errBytes == null)
             errBytes = ctx.marshaller().marshal(err);
@@ -174,9 +165,9 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+        finishUnmarshalCacheObject(failedKey, cctx, ldr);
 
-        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
+        finishUnmarshalCacheObject(nearEvicted, cctx, ldr);
 
         if (errBytes != null && err == null)
             err = ctx.marshaller().unmarshal(errBytes, ldr);
@@ -209,7 +200,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                if (!writer.writeMessage("failedKey", failedKey))
                     return false;
 
                 writer.incrementState();
@@ -221,7 +212,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                if (!writer.writeMessage("nearEvicted", nearEvicted))
                     return false;
 
                 writer.incrementState();
@@ -251,7 +242,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
                 reader.incrementState();
 
             case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+                failedKey = reader.readMessage("failedKey");
 
                 if (!reader.isLastRead())
                     return false;
@@ -267,7 +258,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
                 reader.incrementState();
 
             case 6:
-                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+                nearEvicted = reader.readMessage("nearEvicted");
 
                 if (!reader.isLastRead())
                     return false;
@@ -281,7 +272,7 @@ public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implemen
 
     /** {@inheritDoc} */
     @Override public byte directType() {
-        return 39;
+        return -26;
     }
 
     /** {@inheritDoc} */


[27/51] [abbrv] ignite git commit: ignite-2523 : Created GridDhtAtomicSingleUpdateRequest optimized implementation.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
new file mode 100644
index 0000000..6a69ccc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateResponse.java
@@ -0,0 +1,296 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  * contributor license agreements.  See the NOTICE file distributed with
+ *  * this work for additional information regarding copyright ownership.
+ *  * The ASF licenses this file to You under the Apache License, Version 2.0
+ *  * (the "License"); you may not use this file except in compliance with
+ *  * the License.  You may obtain a copy of the License at
+ *  *
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.
+ *
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class GridDhtAtomicSingleUpdateResponse extends GridCacheMessage implements GridCacheDeployable, GridDhtAtomicUpdateResponse {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Message index. */
+    public static final int CACHE_MSG_IDX = nextIndexId();
+
+    /** Future version. */
+    private GridCacheVersion futVer;
+
+    /** Failed keys. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> failedKeys;
+
+    /** Update error. */
+    @GridDirectTransient
+    private IgniteCheckedException err;
+
+    /** Serialized update error. */
+    private byte[] errBytes;
+
+    /** Evicted readers. */
+    @GridToStringInclude
+    @GridDirectCollection(KeyCacheObject.class)
+    private List<KeyCacheObject> nearEvicted;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public GridDhtAtomicSingleUpdateResponse() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param futVer Future version.
+     * @param addDepInfo Deployment info.
+     */
+    public GridDhtAtomicSingleUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
+        this.cacheId = cacheId;
+        this.futVer = futVer;
+        this.addDepInfo = addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int lookupIndex() {
+        return CACHE_MSG_IDX;
+    }
+
+    /**
+     * @return Future version.
+     */
+    @Override public GridCacheVersion futureVersion() {
+        return futVer;
+    }
+
+    /**
+     * Sets update error.
+     *
+     * @param err Error.
+     */
+    @Override public void onError(IgniteCheckedException err) {
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteCheckedException error() {
+        return err;
+    }
+
+    /**
+     * @return Failed keys.
+     */
+    @Override public Collection<KeyCacheObject> failedKeys() {
+        return failedKeys;
+    }
+
+    /**
+     * Adds key to collection of failed keys.
+     *
+     * @param key Key to add.
+     * @param e Error cause.
+     */
+    @Override public void addFailedKey(KeyCacheObject key, Throwable e) {
+        if (failedKeys == null)
+            failedKeys = new ArrayList<>();
+
+        failedKeys.add(key);
+
+        if (err == null)
+            err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+        err.addSuppressed(e);
+    }
+
+    /**
+     * @return Evicted readers.
+     */
+    @Override public Collection<KeyCacheObject> nearEvicted() {
+        return nearEvicted;
+    }
+
+    /**
+     * Adds near evicted key..
+     *
+     * @param key Evicted key.
+     */
+    @Override public void addNearEvicted(KeyCacheObject key) {
+        if (nearEvicted == null)
+            nearEvicted = new ArrayList<>();
+
+        nearEvicted.add(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        prepareMarshalCacheObjects(failedKeys, cctx);
+
+        prepareMarshalCacheObjects(nearEvicted, cctx);
+
+        if (errBytes == null)
+            errBytes = ctx.marshaller().marshal(err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
+
+        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
+
+        if (errBytes != null && err == null)
+            err = ctx.marshaller().unmarshal(errBytes, ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return addDepInfo;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 3:
+                if (!writer.writeByteArray("errBytes", errBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 4:
+                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 5:
+                if (!writer.writeMessage("futVer", futVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 3:
+                errBytes = reader.readByteArray("errBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 4:
+                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 5:
+                futVer = reader.readMessage("futVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(GridDhtAtomicSingleUpdateResponse.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 39;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 7;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridDhtAtomicSingleUpdateResponse.class, this);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 3a31700..e19a11a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -237,19 +238,34 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                 GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
 
                 if (updateReq == null) {
-                    updateReq = new GridDhtAtomicUpdateRequest(
-                        cctx.cacheId(),
-                        nodeId,
-                        futVer,
-                        writeVer,
-                        syncMode,
-                        topVer,
-                        forceTransformBackups,
-                        this.updateReq.subjectId(),
-                        this.updateReq.taskNameHash(),
-                        forceTransformBackups ? this.updateReq.invokeArguments() : null,
-                        cctx.deploymentEnabled(),
-                        this.updateReq.keepBinary());
+                    if (this.updateReq instanceof GridNearAtomicSingleUpdateRequest)
+                        updateReq = new GridDhtAtomicSingleUpdateRequest(
+                            cctx.cacheId(),
+                            nodeId,
+                            futVer,
+                            writeVer,
+                            syncMode,
+                            topVer,
+                            forceTransformBackups,
+                            this.updateReq.subjectId(),
+                            this.updateReq.taskNameHash(),
+                            forceTransformBackups ? this.updateReq.invokeArguments() : null,
+                            cctx.deploymentEnabled(),
+                            this.updateReq.keepBinary());
+                    else
+                        updateReq = new GridDhtAtomicMultipleUpdateRequest(
+                            cctx.cacheId(),
+                            nodeId,
+                            futVer,
+                            writeVer,
+                            syncMode,
+                            topVer,
+                            forceTransformBackups,
+                            this.updateReq.subjectId(),
+                            this.updateReq.taskNameHash(),
+                            forceTransformBackups ? this.updateReq.invokeArguments() : null,
+                            cctx.deploymentEnabled(),
+                            this.updateReq.keepBinary());
 
                     mappings.put(nodeId, updateReq);
                 }
@@ -309,19 +325,34 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                 if (node == null)
                     continue;
 
-                updateReq = new GridDhtAtomicUpdateRequest(
-                    cctx.cacheId(),
-                    nodeId,
-                    futVer,
-                    writeVer,
-                    syncMode,
-                    topVer,
-                    forceTransformBackups,
-                    this.updateReq.subjectId(),
-                    this.updateReq.taskNameHash(),
-                    forceTransformBackups ? this.updateReq.invokeArguments() : null,
-                    cctx.deploymentEnabled(),
-                    this.updateReq.keepBinary());
+                if (this.updateReq instanceof GridNearAtomicSingleUpdateRequest)
+                    updateReq = new GridDhtAtomicSingleUpdateRequest(
+                        cctx.cacheId(),
+                        nodeId,
+                        futVer,
+                        writeVer,
+                        syncMode,
+                        topVer,
+                        forceTransformBackups,
+                        this.updateReq.subjectId(),
+                        this.updateReq.taskNameHash(),
+                        forceTransformBackups ? this.updateReq.invokeArguments() : null,
+                        cctx.deploymentEnabled(),
+                        this.updateReq.keepBinary());
+                else
+                    updateReq = new GridDhtAtomicMultipleUpdateRequest(
+                        cctx.cacheId(),
+                        nodeId,
+                        futVer,
+                        writeVer,
+                        syncMode,
+                        topVer,
+                        forceTransformBackups,
+                        this.updateReq.subjectId(),
+                        this.updateReq.taskNameHash(),
+                        forceTransformBackups ? this.updateReq.invokeArguments() : null,
+                        cctx.deploymentEnabled(),
+                        this.updateReq.keepBinary());
 
                 mappings.put(nodeId, updateReq);
             }
@@ -348,7 +379,8 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                 if (!mappings.isEmpty()) {
                     Collection<KeyCacheObject> hndKeys = new ArrayList<>(keys.size());
 
-                    exit: for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+                    exit:
+                    for (GridDhtAtomicUpdateRequest req : mappings.values()) {
                         for (int i = 0; i < req.size(); i++) {
                             KeyCacheObject key = req.key(i);
 
@@ -416,7 +448,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void> implement
                     if (log.isDebugEnabled())
                         log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
 
-                    cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+                    cctx.io().send(req.nodeId(), (GridCacheMessage)req, cctx.ioPolicy());
                 }
                 catch (ClusterTopologyCheckedException ignored) {
                     U.warn(log, "Failed to send update request to backup node because it left grid: " +

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 7cc276f..0ab67a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -1,248 +1,44 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  * contributor license agreements.  See the NOTICE file distributed with
+ *  * this work for additional information regarding copyright ownership.
+ *  * The ASF licenses this file to You under the Apache License, Version 2.0
+ *  * (the "License"); you may not use this file except in compliance with
+ *  * the License.  You may obtain a copy of the License at
+ *  *
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.processor.EntryProcessor;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import javax.cache.processor.EntryProcessor;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.UUID;
 
-/**
- * Lite dht cache backup update request.
- */
-public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Node ID. */
-    private UUID nodeId;
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Write version. */
-    private GridCacheVersion writeVer;
-
-    /** Topology version. */
-    private AffinityTopologyVersion topVer;
-
-    /** Keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
-
-    /** Previous values. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> prevVals;
-
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
-
-    /** TTLs. */
-    private GridLongList ttls;
-
-    /** Conflict expire time. */
-    private GridLongList conflictExpireTimes;
-
-    /** Near TTLs. */
-    private GridLongList nearTtls;
-
-    /** Near expire times. */
-    private GridLongList nearExpireTimes;
-
-    /** Write synchronization mode. */
-    private CacheWriteSynchronizationMode syncMode;
-
-    /** Near cache keys to update. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearKeys;
-
-    /** Values to update. */
-    @GridToStringInclude
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> nearVals;
-
-    /** Force transform backups flag. */
-    private boolean forceTransformBackups;
-
-    /** Entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
-
-    /** Near entry processors. */
-    @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> nearEntryProcessors;
-
-    /** Near entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> nearEntryProcessorsBytes;
-
-    /** Optional arguments for entry processor. */
-    @GridDirectTransient
-    private Object[] invokeArgs;
-
-    /** Entry processor arguments bytes. */
-    private byte[][] invokeArgsBytes;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /** Task name hash. */
-    private int taskNameHash;
-
-    /** Partition. */
-    private GridLongList updateCntrs;
-
-    /** On response flag. Access should be synced on future. */
-    @GridDirectTransient
-    private boolean onRes;
-
-    /** */
-    @GridDirectTransient
-    private List<Integer> partIds;
-
-    /** */
-    @GridDirectTransient
-    private List<CacheObject> locPrevVals;
-
-    /** Keep binary flag. */
-    private boolean keepBinary;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridDhtAtomicUpdateRequest() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param cacheId Cache ID.
-     * @param nodeId Node ID.
-     * @param futVer Future version.
-     * @param writeVer Write version for cache values.
-     * @param invokeArgs Optional arguments for entry processor.
-     * @param syncMode Cache write synchronization mode.
-     * @param topVer Topology version.
-     * @param forceTransformBackups Force transform backups flag.
-     * @param subjId Subject ID.
-     * @param taskNameHash Task name hash code.
-     * @param addDepInfo Deployment info.
-     */
-    public GridDhtAtomicUpdateRequest(
-        int cacheId,
-        UUID nodeId,
-        GridCacheVersion futVer,
-        GridCacheVersion writeVer,
-        CacheWriteSynchronizationMode syncMode,
-        @NotNull AffinityTopologyVersion topVer,
-        boolean forceTransformBackups,
-        UUID subjId,
-        int taskNameHash,
-        Object[] invokeArgs,
-        boolean addDepInfo,
-        boolean keepBinary
-    ) {
-        assert invokeArgs == null || forceTransformBackups;
-
-        this.cacheId = cacheId;
-        this.nodeId = nodeId;
-        this.futVer = futVer;
-        this.writeVer = writeVer;
-        this.syncMode = syncMode;
-        this.topVer = topVer;
-        this.forceTransformBackups = forceTransformBackups;
-        this.subjId = subjId;
-        this.taskNameHash = taskNameHash;
-        this.invokeArgs = invokeArgs;
-        this.addDepInfo = addDepInfo;
-        this.keepBinary = keepBinary;
-
-        keys = new ArrayList<>();
-        partIds = new ArrayList<>();
-        locPrevVals = new ArrayList<>();
-
-        if (forceTransformBackups) {
-            entryProcessors = new ArrayList<>();
-            entryProcessorsBytes = new ArrayList<>();
-        }
-        else
-            vals = new ArrayList<>();
-    }
+public interface GridDhtAtomicUpdateRequest {
 
-    /**
-     * @return Force transform backups flag.
-     */
-    public boolean forceTransformBackups() {
-        return forceTransformBackups;
-    }
+    boolean forceTransformBackups();
 
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL (optional).
-     * @param conflictExpireTime Conflict expire time (optional).
-     * @param conflictVer Conflict version (optional).
-     * @param addPrevVal If {@code true} adds previous value.
-     * @param prevVal Previous value.
-     */
-    public void addWriteValue(KeyCacheObject key,
+    void addWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,
         EntryProcessor<Object, Object, Object> entryProcessor,
         long ttl,
@@ -251,815 +47,85 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
         boolean addPrevVal,
         int partId,
         @Nullable CacheObject prevVal,
-        @Nullable Long updateIdx) {
-        keys.add(key);
-
-        partIds.add(partId);
-
-        locPrevVals.add(prevVal);
-
-        if (forceTransformBackups) {
-            assert entryProcessor != null;
-
-            entryProcessors.add(entryProcessor);
-        }
-        else
-            vals.add(val);
-
-        if (addPrevVal) {
-            if (prevVals == null)
-                prevVals = new ArrayList<>();
-
-            prevVals.add(prevVal);
-        }
-
-        if (updateIdx != null) {
-            if (updateCntrs == null)
-                updateCntrs = new GridLongList();
-
-            updateCntrs.add(updateIdx);
-        }
-
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>();
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (ttl >= 0) {
-            if (ttls == null) {
-                ttls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    ttls.add(CU.TTL_NOT_CHANGED);
-            }
-        }
+        @Nullable Long updateIdx);
 
-        if (ttls != null)
-            ttls.add(ttl);
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-        }
-
-        if (conflictExpireTimes != null)
-            conflictExpireTimes.add(conflictExpireTime);
-    }
-
-    /**
-     * @param key Key to add.
-     * @param val Value, {@code null} if should be removed.
-     * @param entryProcessor Entry processor.
-     * @param ttl TTL.
-     * @param expireTime Expire time.
-     */
-    public void addNearWriteValue(KeyCacheObject key,
+    void addNearWriteValue(KeyCacheObject key,
         @Nullable CacheObject val,
         EntryProcessor<Object, Object, Object> entryProcessor,
         long ttl,
-        long expireTime) {
-        if (nearKeys == null) {
-            nearKeys = new ArrayList<>();
-
-            if (forceTransformBackups) {
-                nearEntryProcessors = new ArrayList<>();
-                nearEntryProcessorsBytes = new ArrayList<>();
-            }
-            else
-                nearVals = new ArrayList<>();
-        }
-
-        nearKeys.add(key);
-
-        if (forceTransformBackups) {
-            assert entryProcessor != null;
-
-            nearEntryProcessors.add(entryProcessor);
-        }
-        else
-            nearVals.add(val);
-
-        if (ttl >= 0) {
-            if (nearTtls == null) {
-                nearTtls = new GridLongList(nearKeys.size());
-
-                for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearTtls.add(CU.TTL_NOT_CHANGED);
-            }
-        }
-
-        if (nearTtls != null)
-            nearTtls.add(ttl);
-
-        if (expireTime >= 0) {
-            if (nearExpireTimes == null) {
-                nearExpireTimes = new GridLongList(nearKeys.size());
-
-                for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
-        }
-
-        if (nearExpireTimes != null)
-            nearExpireTimes.add(expireTime);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /**
-     * @return Node ID.
-     */
-    public UUID nodeId() {
-        return nodeId;
-    }
-
-    /**
-     * @return Subject ID.
-     */
-    public UUID subjectId() {
-        return subjId;
-    }
-
-    /**
-     * @return Task name.
-     */
-    public int taskNameHash() {
-        return taskNameHash;
-    }
-
-    /**
-     * @return Keys size.
-     */
-    public int size() {
-        return keys.size();
-    }
-
-    /**
-     * @return Keys size.
-     */
-    public int nearSize() {
-        return nearKeys != null ? nearKeys.size() : 0;
-    }
-
-    /**
-     * @return Version assigned on primary node.
-     */
-    public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /**
-     * @return Write version.
-     */
-    public GridCacheVersion writeVersion() {
-        return writeVer;
-    }
-
-    /**
-     * @return Cache write synchronization mode.
-     */
-    public CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return syncMode;
-    }
-
-    /**
-     * @return Topology version.
-     */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return topVer;
-    }
-
-    /**
-     * @return Keys.
-     */
-    public Collection<KeyCacheObject> keys() {
-        return keys;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Key.
-     */
-    public KeyCacheObject key(int idx) {
-        return keys.get(idx);
-    }
-
-    /**
-     * @param idx Partition index.
-     * @return Partition id.
-     */
-    public int partitionId(int idx) {
-        return partIds.get(idx);
-    }
-
-    /**
-     * @param updCntr Update counter.
-     * @return Update counter.
-     */
-    public Long updateCounter(int updCntr) {
-        if (updateCntrs != null && updCntr < updateCntrs.size())
-            return updateCntrs.get(updCntr);
-
-        return null;
-    }
-
-    /**
-     * @param idx Near key index.
-     * @return Key.
-     */
-    public KeyCacheObject nearKey(int idx) {
-        return nearKeys.get(idx);
-    }
-
-    /**
-     * @return Keep binary flag.
-     */
-    public boolean keepBinary() {
-        return keepBinary;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable public CacheObject value(int idx) {
-        if (vals != null)
-            return vals.get(idx);
-
-        return null;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable public CacheObject previousValue(int idx) {
-        if (prevVals != null)
-            return prevVals.get(idx);
-
-        return null;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Value.
-     */
-    @Nullable public CacheObject localPreviousValue(int idx) {
-        return locPrevVals.get(idx);
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Entry processor.
-     */
-    @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
-        return entryProcessors == null ? null : entryProcessors.get(idx);
-    }
-
-    /**
-     * @param idx Near key index.
-     * @return Value.
-     */
-    @Nullable public CacheObject nearValue(int idx) {
-        if (nearVals != null)
-            return nearVals.get(idx);
-
-        return null;
-    }
-
-    /**
-     * @param idx Key index.
-     * @return Transform closure.
-     */
-    @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
-        return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
-    }
-
-    /**
-     * @param idx Index.
-     * @return Conflict version.
-     */
-    @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
-
-        return null;
-    }
-
-    /**
-     * @param idx Index.
-     * @return TTL.
-     */
-    public long ttl(int idx) {
-        if (ttls != null) {
-            assert idx >= 0 && idx < ttls.size();
-
-            return ttls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /**
-     * @param idx Index.
-     * @return TTL for near cache update.
-     */
-    public long nearTtl(int idx) {
-        if (nearTtls != null) {
-            assert idx >= 0 && idx < nearTtls.size();
-
-            return nearTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
-    }
-
-    /**
-     * @param idx Index.
-     * @return Conflict expire time.
-     */
-    public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
-
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /**
-     * @param idx Index.
-     * @return Expire time for near cache update.
-     */
-    public long nearExpireTime(int idx) {
-        if (nearExpireTimes != null) {
-            assert idx >= 0 && idx < nearExpireTimes.size();
-
-            return nearExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
-    }
-
-    /**
-     * @return {@code True} if on response flag changed.
-     */
-    public boolean onResponse() {
-        return !onRes && (onRes = true);
-    }
-
-    /**
-     * @return Optional arguments for entry processor.
-     */
-    @Nullable public Object[] invokeArguments() {
-        return invokeArgs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(keys, cctx);
-
-        prepareMarshalCacheObjects(vals, cctx);
-
-        prepareMarshalCacheObjects(nearKeys, cctx);
-
-        prepareMarshalCacheObjects(nearVals, cctx);
-
-        prepareMarshalCacheObjects(prevVals, cctx);
-
-        if (forceTransformBackups) {
-            // force addition of deployment info for entry processors if P2P is enabled globally.
-            if (!addDepInfo && ctx.deploymentEnabled())
-                addDepInfo = true;
-
-            if (invokeArgsBytes == null)
-                invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
-
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
-            if (nearEntryProcessorsBytes == null)
-                nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, cctx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(vals, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearVals, cctx, ldr);
-
-        finishUnmarshalCacheObjects(prevVals, cctx, ldr);
-
-        if (forceTransformBackups) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
-            if (invokeArgs == null)
-                invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
-
-            if (nearEntryProcessors == null)
-                nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups))
-                    return false;
-
-                writer.incrementState();
-
-            case 7:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 8:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 9:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
-                    return false;
-
-                writer.incrementState();
-
-            case 10:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 11:
-                if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
-                    return false;
-
-                writer.incrementState();
-
-            case 12:
-                if (!writer.writeMessage("nearExpireTimes", nearExpireTimes))
-                    return false;
-
-                writer.incrementState();
-
-            case 13:
-                if (!writer.writeCollection("nearKeys", nearKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 14:
-                if (!writer.writeMessage("nearTtls", nearTtls))
-                    return false;
-
-                writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("nearVals", nearVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
-                if (!writer.writeCollection("prevVals", prevVals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 17:
-                if (!writer.writeUuid("subjId", subjId))
-                    return false;
-
-                writer.incrementState();
-
-            case 18:
-                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
-                    return false;
-
-                writer.incrementState();
-
-            case 19:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
-                    return false;
-
-                writer.incrementState();
-
-            case 20:
-                if (!writer.writeMessage("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 21:
-                if (!writer.writeMessage("ttls", ttls))
-                    return false;
-
-                writer.incrementState();
-
-            case 22:
-                if (!writer.writeMessage("updateCntrs", updateCntrs))
-                    return false;
-
-                writer.incrementState();
-
-            case 23:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 24:
-                if (!writer.writeMessage("writeVer", writeVer))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 5:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 6:
-                forceTransformBackups = reader.readBoolean("forceTransformBackups");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 7:
-                futVer = reader.readMessage("futVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 8:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 9:
-                keepBinary = reader.readBoolean("keepBinary");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 10:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 11:
-                nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 12:
-                nearExpireTimes = reader.readMessage("nearExpireTimes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 13:
-                nearKeys = reader.readCollection("nearKeys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 14:
-                nearTtls = reader.readMessage("nearTtls");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
+        long expireTime);
 
-            case 15:
-                nearVals = reader.readCollection("nearVals", MessageCollectionItemType.MSG);
+    int lookupIndex();
 
-                if (!reader.isLastRead())
-                    return false;
+    UUID nodeId();
 
-                reader.incrementState();
+    UUID subjectId();
 
-            case 16:
-                prevVals = reader.readCollection("prevVals", MessageCollectionItemType.MSG);
+    int taskNameHash();
 
-                if (!reader.isLastRead())
-                    return false;
+    int size();
 
-                reader.incrementState();
+    int nearSize();
 
-            case 17:
-                subjId = reader.readUuid("subjId");
+    GridCacheVersion futureVersion();
 
-                if (!reader.isLastRead())
-                    return false;
+    GridCacheVersion writeVersion();
 
-                reader.incrementState();
+    CacheWriteSynchronizationMode writeSynchronizationMode();
 
-            case 18:
-                byte syncModeOrd;
+    AffinityTopologyVersion topologyVersion();
 
-                syncModeOrd = reader.readByte("syncMode");
+    Collection<KeyCacheObject> keys();
 
-                if (!reader.isLastRead())
-                    return false;
+    KeyCacheObject key(int idx);
 
-                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+    int partitionId(int idx);
 
-                reader.incrementState();
+    Long updateCounter(int updCntr);
 
-            case 19:
-                taskNameHash = reader.readInt("taskNameHash");
+    KeyCacheObject nearKey(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    boolean keepBinary();
 
-                reader.incrementState();
+    @Nullable CacheObject value(int idx);
 
-            case 20:
-                topVer = reader.readMessage("topVer");
+    @Nullable CacheObject previousValue(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    @Nullable CacheObject localPreviousValue(int idx);
 
-                reader.incrementState();
+    @Nullable EntryProcessor<Object, Object, Object> entryProcessor(int idx);
 
-            case 21:
-                ttls = reader.readMessage("ttls");
+    @Nullable CacheObject nearValue(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    @Nullable EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
 
-                reader.incrementState();
+    @Nullable GridCacheVersion conflictVersion(int idx);
 
-            case 22:
-                updateCntrs = reader.readMessage("updateCntrs");
+    long ttl(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    long nearTtl(int idx);
 
-                reader.incrementState();
+    long conflictExpireTime(int idx);
 
-            case 23:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+    long nearExpireTime(int idx);
 
-                if (!reader.isLastRead())
-                    return false;
+    boolean onResponse();
 
-                reader.incrementState();
+    @Nullable Object[] invokeArguments();
 
-            case 24:
-                writeVer = reader.readMessage("writeVer");
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
 
-                if (!reader.isLastRead())
-                    return false;
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
 
-                reader.incrementState();
+    boolean addDeploymentInfo();
 
-        }
+    boolean writeTo(ByteBuffer buf, MessageWriter writer);
 
-        return reader.afterMessageRead(GridDhtAtomicUpdateRequest.class);
-    }
+    boolean readFrom(ByteBuffer buf, MessageReader reader);
 
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 38;
-    }
+    byte directType();
 
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 25;
-    }
+    byte fieldsCount();
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtAtomicUpdateRequest.class, this, "super", super.toString());
-    }
+    IgniteCheckedException classError();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 8f1d9a2..a74fed6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -1,297 +1,63 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  * contributor license agreements.  See the NOTICE file distributed with
+ *  * this work for additional information regarding copyright ownership.
+ *  * The ASF licenses this file to You under the Apache License, Version 2.0
+ *  * (the "License"); you may not use this file except in compliance with
+ *  * the License.  You may obtain a copy of the License at
+ *  *
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import java.nio.ByteBuffer;
+import java.util.Collection;
 
-/**
- * DHT atomic cache backup update response.
- */
-public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements GridCacheDeployable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Message index. */
-    public static final int CACHE_MSG_IDX = nextIndexId();
-
-    /** Future version. */
-    private GridCacheVersion futVer;
-
-    /** Failed keys. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> failedKeys;
-
-    /** Update error. */
-    @GridDirectTransient
-    private IgniteCheckedException err;
-
-    /** Serialized update error. */
-    private byte[] errBytes;
-
-    /** Evicted readers. */
-    @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> nearEvicted;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridDhtAtomicUpdateResponse() {
-        // No-op.
-    }
-
-    /**
-     * @param cacheId Cache ID.
-     * @param futVer Future version.
-     * @param addDepInfo Deployment info.
-     */
-    public GridDhtAtomicUpdateResponse(int cacheId, GridCacheVersion futVer, boolean addDepInfo) {
-        this.cacheId = cacheId;
-        this.futVer = futVer;
-        this.addDepInfo = addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int lookupIndex() {
-        return CACHE_MSG_IDX;
-    }
-
-    /**
-     * @return Future version.
-     */
-    public GridCacheVersion futureVersion() {
-        return futVer;
-    }
-
-    /**
-     * Sets update error.
-     *
-     * @param err Error.
-     */
-    public void onError(IgniteCheckedException err){
-        this.err = err;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteCheckedException error() {
-        return err;
-    }
-
-    /**
-     * @return Failed keys.
-     */
-    public Collection<KeyCacheObject> failedKeys() {
-        return failedKeys;
-    }
-
-    /**
-     * Adds key to collection of failed keys.
-     *
-     * @param key Key to add.
-     * @param e Error cause.
-     */
-    public void addFailedKey(KeyCacheObject key, Throwable e) {
-        if (failedKeys == null)
-            failedKeys = new ArrayList<>();
-
-        failedKeys.add(key);
-
-        if (err == null)
-            err = new IgniteCheckedException("Failed to update keys on primary node.");
-
-        err.addSuppressed(e);
-    }
-
-    /**
-     * @return Evicted readers.
-     */
-    public Collection<KeyCacheObject> nearEvicted() {
-        return nearEvicted;
-    }
-
-    /**
-     * Adds near evicted key..
-     *
-     * @param key Evicted key.
-     */
-    public void addNearEvicted(KeyCacheObject key) {
-        if (nearEvicted == null)
-            nearEvicted = new ArrayList<>();
-
-        nearEvicted.add(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        prepareMarshalCacheObjects(failedKeys, cctx);
-
-        prepareMarshalCacheObjects(nearEvicted, cctx);
-
-        if (errBytes == null)
-            errBytes = ctx.marshaller().marshal(err);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
-
-        finishUnmarshalCacheObjects(failedKeys, cctx, ldr);
-
-        finishUnmarshalCacheObjects(nearEvicted, cctx, ldr);
-
-        if (errBytes != null && err == null)
-            err = ctx.marshaller().unmarshal(errBytes, ldr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addDeploymentInfo() {
-        return addDepInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeByteArray("errBytes", errBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
-                if (!writer.writeCollection("failedKeys", failedKeys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 5:
-                if (!writer.writeMessage("futVer", futVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                errBytes = reader.readByteArray("errBytes");
-
-                if (!reader.isLastRead())
-                    return false;
+public interface GridDhtAtomicUpdateResponse {
+    int lookupIndex();
 
-                reader.incrementState();
+    GridCacheVersion futureVersion();
 
-            case 4:
-                failedKeys = reader.readCollection("failedKeys", MessageCollectionItemType.MSG);
+    void onError(IgniteCheckedException err);
 
-                if (!reader.isLastRead())
-                    return false;
+    IgniteCheckedException error();
 
-                reader.incrementState();
+    Collection<KeyCacheObject> failedKeys();
 
-            case 5:
-                futVer = reader.readMessage("futVer");
+    void addFailedKey(KeyCacheObject key, Throwable e);
 
-                if (!reader.isLastRead())
-                    return false;
+    Collection<KeyCacheObject> nearEvicted();
 
-                reader.incrementState();
+    void addNearEvicted(KeyCacheObject key);
 
-            case 6:
-                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+    void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException;
 
-                if (!reader.isLastRead())
-                    return false;
+    void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException;
 
-                reader.incrementState();
+    boolean addDeploymentInfo();
 
-        }
+    boolean writeTo(ByteBuffer buf, MessageWriter writer);
 
-        return reader.afterMessageRead(GridDhtAtomicUpdateResponse.class);
-    }
+    boolean readFrom(ByteBuffer buf, MessageReader reader);
 
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 39;
-    }
+    byte directType();
 
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 7;
-    }
+    byte fieldsCount();
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtAtomicUpdateResponse.class, this);
-    }
+    long messageId();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
index b3f7e74..d6eabd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateResponse.java
@@ -593,7 +593,7 @@ public class GridNearAtomicSingleUpdateResponse extends GridCacheMessage impleme
 
         }
 
-        return reader.afterMessageRead(GridNearAtomicMultipleUpdateResponse.class);
+        return reader.afterMessageRead(GridNearAtomicSingleUpdateResponse.class);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 5aef8e7..168076a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -43,9 +43,9 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateResponse;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 50a6114..0633a1e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicMultipleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicMultipleUpdateRequest;
 import org.apache.ignite.lang.IgniteInClosure;
@@ -140,7 +140,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
             commSpi.registerMessage(GridNearAtomicMultipleUpdateRequest.class);
             commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
-            commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
+            commSpi.registerMessage(GridDhtAtomicMultipleUpdateRequest.class);
 
             int putCnt = 15;
 
@@ -210,7 +210,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
      * @return Count.
      */
     private int dhtRequestsCount(TestCommunicationSpi commSpi) {
-        return commSpi.messageCount(GridDhtAtomicUpdateRequest.class);
+        return commSpi.messageCount(GridDhtAtomicMultipleUpdateRequest.class);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3391c847/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 0e7755b..e3adc21 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -480,7 +480,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             return delay && (
                 (origMsg instanceof GridNearAtomicMultipleUpdateRequest) ||
                 (origMsg instanceof GridNearAtomicSingleUpdateRequest) ||
-                (origMsg instanceof GridDhtAtomicUpdateRequest)
+                (origMsg instanceof GridDhtAtomicMultipleUpdateRequest)
             );
         }
     }


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

Posted by vo...@apache.org.
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/52d20cdc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/52d20cdc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/52d20cdc

Branch: refs/heads/ignite-2523
Commit: 52d20cdcdc886c6ceaed49239e822a1d6deaa7dd
Parents: 2a1a31d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 3 12:03:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 3 12:03:31 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMessage.java      |  49 ++++
 .../GridNearAtomicSingleUpdateRequest.java      | 258 +++++++------------
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   6 +-
 3 files changed, 137 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/52d20cdc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index 83e3aa7..cdf579d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -463,6 +463,24 @@ public abstract class GridCacheMessage implements Message {
     }
 
     /**
+     * @param obj Object to marshal.
+     * @param ctx Context.
+     * @return Marshalled collection.
+     * @throws IgniteCheckedException If failed.
+     */
+    @Nullable protected byte[] marshal(@Nullable Object obj, GridCacheContext ctx) throws IgniteCheckedException {
+        assert ctx != null;
+
+        if (obj == null)
+            return null;
+
+        if (addDepInfo)
+            prepareObject(obj, ctx);
+
+        return CU.marshal(ctx, obj);
+    }
+
+    /**
      * @param col Collection to marshal.
      * @param ctx Context.
      * @return Marshalled collection.
@@ -539,6 +557,19 @@ public abstract class GridCacheMessage implements Message {
     }
 
     /**
+     * @param obj Object.
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach")
+    protected final void finishUnmarshalCacheObject(@Nullable CacheObject obj, GridCacheContext ctx, ClassLoader ldr)
+        throws IgniteCheckedException {
+        if (obj != null)
+            obj.finishUnmarshal(ctx.cacheObjectContext(), ldr);
+    }
+
+    /**
      * @param col Collection.
      * @param ctx Context.
      * @param ldr Class loader.
@@ -584,6 +615,24 @@ public abstract class GridCacheMessage implements Message {
     }
 
     /**
+     * @param bytes Byte array to unmarshal.
+     * @param ctx Context.
+     * @param ldr Loader.
+     * @return Unmarshalled object.
+     * @throws IgniteCheckedException If failed.
+     */
+    @Nullable protected <T> T unmarshal(@Nullable byte[] bytes, GridCacheSharedContext ctx, ClassLoader ldr)
+        throws IgniteCheckedException {
+        assert ldr != null;
+        assert ctx != null;
+
+        if (bytes == null)
+            return null;
+
+        return ctx.marshaller().unmarshal(bytes, ldr);
+    }
+
+    /**
      * @param byteCol Collection to unmarshal.
      * @param ctx Context.
      * @param ldr Loader.

http://git-wip-us.apache.org/repos/asf/ignite/blob/52d20cdc/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 5de9884..cee662c 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
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
@@ -32,7 +31,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -46,8 +44,8 @@ import javax.cache.expiry.ExpiryPolicy;
 import javax.cache.processor.EntryProcessor;
 import java.io.Externalizable;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
@@ -91,22 +89,19 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     /** Update operation. */
     private GridCacheOperation op;
 
-    /** Keys to update. */
+    /** Key to update. */
     @GridToStringInclude
-    @GridDirectCollection(KeyCacheObject.class)
-    private List<KeyCacheObject> keys;
+    private KeyCacheObject key;
 
-    /** Values to update. */
-    @GridDirectCollection(CacheObject.class)
-    private List<CacheObject> vals;
+    /** Value to update. */
+    private CacheObject val;
 
-    /** Entry processors. */
+    /** Entry processor. */
     @GridDirectTransient
-    private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+    private EntryProcessor<Object, Object, Object> entryProc;
 
-    /** Entry processors bytes. */
-    @GridDirectCollection(byte[].class)
-    private List<byte[]> entryProcessorsBytes;
+    /** Entry processor bytes. */
+    private byte[] entryProcBytes;
 
     /** Optional arguments for entry processor. */
     @GridDirectTransient
@@ -115,15 +110,14 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     /** Entry processor arguments bytes. */
     private byte[][] invokeArgsBytes;
 
-    /** Conflict versions. */
-    @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> conflictVers;
+    /** Conflict version. */
+    private GridCacheVersion conflictVer;
 
-    /** Conflict TTLs. */
-    private GridLongList conflictTtls;
+    /** Conflict TTL. */
+    private long conflictTtl = CU.TTL_NOT_CHANGED;
 
-    /** Conflict expire times. */
-    private GridLongList conflictExpireTimes;
+    /** Conflict expire time. */
+    private long conflictExpireTime = CU.EXPIRE_TIME_CALCULATE;
 
     /** Return value flag. */
     private boolean retval;
@@ -138,9 +132,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     /** Filter. */
     private CacheEntryPredicate[] filter;
 
-    /** Flag indicating whether request contains primary keys. */
-    private boolean hasPrimary;
-
     /** Subject ID. */
     private UUID subjId;
 
@@ -160,10 +151,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
     @GridDirectTransient
     private GridNearAtomicUpdateResponse res;
 
-    /** Maximum possible size of inner collections. */
-    @GridDirectTransient
-    private int initSize;
-
     /**
      * Empty constructor required by {@link Externalizable}.
      */
@@ -193,7 +180,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @param keepBinary Keep binary flag.
      * @param clientReq Client node request flag.
      * @param addDepInfo Deployment info flag.
-     * @param maxEntryCnt Maximum entries count.
      */
     public GridNearAtomicSingleUpdateRequest(
         int cacheId,
@@ -214,8 +200,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         boolean skipStore,
         boolean keepBinary,
         boolean clientReq,
-        boolean addDepInfo,
-        int maxEntryCnt
+        boolean addDepInfo
     ) {
         assert futVer != null;
 
@@ -239,14 +224,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
         this.keepBinary = keepBinary;
         this.clientReq = clientReq;
         this.addDepInfo = addDepInfo;
-
-        // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
-        // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
-        // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
-        // than 10, we use it.
-        initSize = Math.min(maxEntryCnt, 10);
-
-        keys = new ArrayList<>(initSize);
     }
 
     /** {@inheritDoc} */
@@ -372,14 +349,13 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @param conflictTtl Conflict TTL (optional).
      * @param conflictExpireTime Conflict expire time (optional).
      * @param conflictVer Conflict version (optional).
-     * @param primary If given key is primary on this mapping.
      */
+    @SuppressWarnings("unchecked")
     public void addUpdateEntry(KeyCacheObject key,
         @Nullable Object val,
         long conflictTtl,
         long conflictExpireTime,
-        @Nullable GridCacheVersion conflictVer,
-        boolean primary) {
+        @Nullable GridCacheVersion conflictVer) {
         EntryProcessor<Object, Object, Object> entryProcessor = null;
 
         if (op == TRANSFORM) {
@@ -390,74 +366,37 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
         assert val != null || op == DELETE;
 
-        keys.add(key);
+        this.key = key;
 
-        if (entryProcessor != null) {
-            if (entryProcessors == null)
-                entryProcessors = new ArrayList<>(initSize);
-
-            entryProcessors.add(entryProcessor);
-        }
+        if (entryProcessor != null)
+            this.entryProc = entryProcessor;
         else if (val != null) {
             assert val instanceof CacheObject : val;
 
-            if (vals == null)
-                vals = new ArrayList<>(initSize);
-
-            vals.add((CacheObject)val);
+            this.val = (CacheObject)val;
         }
 
-        hasPrimary |= primary;
+        this.conflictVer = conflictVer;
 
-        // In case there is no conflict, do not create the list.
-        if (conflictVer != null) {
-            if (conflictVers == null) {
-                conflictVers = new ArrayList<>(initSize);
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictVers.add(null);
-            }
-
-            conflictVers.add(conflictVer);
-        }
-        else if (conflictVers != null)
-            conflictVers.add(null);
-
-        if (conflictTtl >= 0) {
-            if (conflictTtls == null) {
-                conflictTtls = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictTtls.add(CU.TTL_NOT_CHANGED);
-            }
-
-            conflictTtls.add(conflictTtl);
-        }
-
-        if (conflictExpireTime >= 0) {
-            if (conflictExpireTimes == null) {
-                conflictExpireTimes = new GridLongList(keys.size());
-
-                for (int i = 0; i < keys.size() - 1; i++)
-                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
-            }
+        if (conflictTtl >= 0)
+            this.conflictTtl = conflictTtl;
 
-            conflictExpireTimes.add(conflictExpireTime);
-        }
+        if (conflictExpireTime >= 0)
+            this.conflictExpireTime = conflictExpireTime;
     }
 
     /**
      * @return Keys for this update request.
      */
     public List<KeyCacheObject> keys() {
-        return keys;
+        return Collections.singletonList(key);
     }
 
     /**
      * @return Values for this update request.
      */
     public List<?> values() {
-        return op == TRANSFORM ? entryProcessors : vals;
+        return Collections.singletonList(op == TRANSFORM ? entryProc : val);
     }
 
     /**
@@ -480,9 +419,10 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      */
     @SuppressWarnings("unchecked")
     public CacheObject value(int idx) {
+        assert idx == 0;
         assert op == UPDATE : op;
 
-        return vals.get(idx);
+        return val;
     }
 
     /**
@@ -491,9 +431,10 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      */
     @SuppressWarnings("unchecked")
     public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+        assert idx == 0;
         assert op == TRANSFORM : op;
 
-        return entryProcessors.get(idx);
+        return entryProc;
     }
 
     /**
@@ -501,17 +442,16 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @return Write value - either value, or transform closure.
      */
     public CacheObject writeValue(int idx) {
-        if (vals != null)
-            return vals.get(idx);
+        assert idx == 0;
 
-        return null;
+        return val;
     }
 
     /**
      * @return Conflict versions.
      */
     @Nullable public List<GridCacheVersion> conflictVersions() {
-        return conflictVers;
+        return conflictVer == null ? null : Collections.singletonList(conflictVer);
     }
 
     /**
@@ -519,13 +459,9 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @return Conflict version.
      */
     @Nullable public GridCacheVersion conflictVersion(int idx) {
-        if (conflictVers != null) {
-            assert idx >= 0 && idx < conflictVers.size();
-
-            return conflictVers.get(idx);
-        }
+        assert idx == 0;
 
-        return null;
+        return conflictVer;
     }
 
     /**
@@ -533,13 +469,9 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @return Conflict TTL.
      */
     public long conflictTtl(int idx) {
-        if (conflictTtls != null) {
-            assert idx >= 0 && idx < conflictTtls.size();
+        assert idx == 0;
 
-            return conflictTtls.get(idx);
-        }
-
-        return CU.TTL_NOT_CHANGED;
+        return conflictTtl;
     }
 
     /**
@@ -547,20 +479,16 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
      * @return Conflict expire time.
      */
     public long conflictExpireTime(int idx) {
-        if (conflictExpireTimes != null) {
-            assert idx >= 0 && idx < conflictExpireTimes.size();
+        assert idx == 0;
 
-            return conflictExpireTimes.get(idx);
-        }
-
-        return CU.EXPIRE_TIME_CALCULATE;
+        return conflictExpireTime;
     }
 
     /**
      * @return Flag indicating whether this request contains primary keys.
      */
     public boolean hasPrimary() {
-        return hasPrimary;
+        return true;
     }
 
     /**
@@ -591,7 +519,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 
-        prepareMarshalCacheObjects(keys, cctx);
+        prepareMarshalCacheObject(key, cctx);
 
         if (filter != null) {
             boolean hasFilter = false;
@@ -616,14 +544,14 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
             if (!addDepInfo && ctx.deploymentEnabled())
                 addDepInfo = true;
 
-            if (entryProcessorsBytes == null)
-                entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+            if (entryProcBytes == null)
+                entryProcBytes = marshal(entryProc, cctx);
 
             if (invokeArgsBytes == null)
                 invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
         }
         else
-            prepareMarshalCacheObjects(vals, cctx);
+            prepareMarshalCacheObject(val, cctx);
     }
 
     /** {@inheritDoc} */
@@ -632,17 +560,17 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
         GridCacheContext cctx = ctx.cacheContext(cacheId);
 
-        finishUnmarshalCacheObjects(keys, cctx, ldr);
+        finishUnmarshalCacheObject(key, cctx, ldr);
 
         if (op == TRANSFORM) {
-            if (entryProcessors == null)
-                entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+            if (entryProc == null)
+                entryProc = unmarshal(entryProcBytes, ctx, ldr);
 
             if (invokeArgs == null)
                 invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
         }
         else
-            finishUnmarshalCacheObjects(vals, cctx, ldr);
+            finishUnmarshalCacheObject(val, cctx, ldr);
 
         if (filter != null) {
             for (CacheEntryPredicate p : filter) {
@@ -682,25 +610,25 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+                if (!writer.writeLong("conflictExpireTime", conflictExpireTime))
                     return false;
 
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeMessage("conflictTtls", conflictTtls))
+                if (!writer.writeLong("conflictTtl", conflictTtl))
                     return false;
 
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+                if (!writer.writeMessage("conflictVer", conflictVer))
                     return false;
 
                 writer.incrementState();
 
             case 7:
-                if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+                if (!writer.writeByteArray("entryProcBytes", entryProcBytes))
                     return false;
 
                 writer.incrementState();
@@ -730,85 +658,79 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 writer.incrementState();
 
             case 12:
-                if (!writer.writeBoolean("hasPrimary", hasPrimary))
+                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
                     return false;
 
                 writer.incrementState();
 
             case 13:
-                if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+                if (!writer.writeBoolean("keepBinary", keepBinary))
                     return false;
 
                 writer.incrementState();
 
             case 14:
-                if (!writer.writeBoolean("keepBinary", keepBinary))
+                if (!writer.writeMessage("key", key))
                     return false;
 
                 writer.incrementState();
 
             case 15:
-                if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 16:
                 if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
                     return false;
 
                 writer.incrementState();
 
-            case 17:
+            case 16:
                 if (!writer.writeBoolean("retval", retval))
                     return false;
 
                 writer.incrementState();
 
-            case 18:
+            case 17:
                 if (!writer.writeBoolean("skipStore", skipStore))
                     return false;
 
                 writer.incrementState();
 
-            case 19:
+            case 18:
                 if (!writer.writeUuid("subjId", subjId))
                     return false;
 
                 writer.incrementState();
 
-            case 20:
+            case 19:
                 if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
                     return false;
 
                 writer.incrementState();
 
-            case 21:
+            case 20:
                 if (!writer.writeInt("taskNameHash", taskNameHash))
                     return false;
 
                 writer.incrementState();
 
-            case 22:
+            case 21:
                 if (!writer.writeBoolean("topLocked", topLocked))
                     return false;
 
                 writer.incrementState();
 
-            case 23:
+            case 22:
                 if (!writer.writeMessage("topVer", topVer))
                     return false;
 
                 writer.incrementState();
 
-            case 24:
+            case 23:
                 if (!writer.writeMessage("updateVer", updateVer))
                     return false;
 
                 writer.incrementState();
 
-            case 25:
-                if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+            case 24:
+                if (!writer.writeMessage("val", val))
                     return false;
 
                 writer.incrementState();
@@ -838,7 +760,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 4:
-                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+                conflictExpireTime = reader.readLong("conflictExpireTime");
 
                 if (!reader.isLastRead())
                     return false;
@@ -846,7 +768,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 5:
-                conflictTtls = reader.readMessage("conflictTtls");
+                conflictTtl = reader.readLong("conflictTtl");
 
                 if (!reader.isLastRead())
                     return false;
@@ -854,7 +776,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 6:
-                conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+                conflictVer = reader.readMessage("conflictVer");
 
                 if (!reader.isLastRead())
                     return false;
@@ -862,7 +784,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 7:
-                entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+                entryProcBytes = reader.readByteArray("entryProcBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -902,7 +824,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 12:
-                hasPrimary = reader.readBoolean("hasPrimary");
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
 
                 if (!reader.isLastRead())
                     return false;
@@ -910,7 +832,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 13:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+                keepBinary = reader.readBoolean("keepBinary");
 
                 if (!reader.isLastRead())
                     return false;
@@ -918,7 +840,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 14:
-                keepBinary = reader.readBoolean("keepBinary");
+                key = reader.readMessage("key");
 
                 if (!reader.isLastRead())
                     return false;
@@ -926,14 +848,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
                 reader.incrementState();
 
             case 15:
-                keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 16:
                 byte opOrd;
 
                 opOrd = reader.readByte("op");
@@ -945,7 +859,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 17:
+            case 16:
                 retval = reader.readBoolean("retval");
 
                 if (!reader.isLastRead())
@@ -953,7 +867,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 18:
+            case 17:
                 skipStore = reader.readBoolean("skipStore");
 
                 if (!reader.isLastRead())
@@ -961,7 +875,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 19:
+            case 18:
                 subjId = reader.readUuid("subjId");
 
                 if (!reader.isLastRead())
@@ -969,7 +883,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 20:
+            case 19:
                 byte syncModeOrd;
 
                 syncModeOrd = reader.readByte("syncMode");
@@ -981,7 +895,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 21:
+            case 20:
                 taskNameHash = reader.readInt("taskNameHash");
 
                 if (!reader.isLastRead())
@@ -989,7 +903,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 22:
+            case 21:
                 topLocked = reader.readBoolean("topLocked");
 
                 if (!reader.isLastRead())
@@ -997,7 +911,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 23:
+            case 22:
                 topVer = reader.readMessage("topVer");
 
                 if (!reader.isLastRead())
@@ -1005,7 +919,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 24:
+            case 23:
                 updateVer = reader.readMessage("updateVer");
 
                 if (!reader.isLastRead())
@@ -1013,8 +927,8 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
                 reader.incrementState();
 
-            case 25:
-                vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+            case 24:
+                val = reader.readMessage("val");
 
                 if (!reader.isLastRead())
                     return false;
@@ -1033,7 +947,7 @@ public class GridNearAtomicSingleUpdateRequest extends GridCacheMessage
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 26;
+        return 25;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/52d20cdc/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 493c765..38e93ec 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
@@ -1028,15 +1028,13 @@ public class GridNearAtomicUpdateFuture extends GridNearAbstractAtomicUpdateFutu
                 skipStore,
                 keepBinary,
                 cctx.kernalContext().clientNode(),
-                cctx.deploymentEnabled(),
-                1);
+                cctx.deploymentEnabled());
 
             req.addUpdateEntry(cacheKey,
                 val,
                 conflictTtl,
                 conflictExpireTime,
-                conflictVer,
-                true);
+                conflictVer);
 
             return req;
         }


[12/51] [abbrv] ignite git commit: IGNITE-2523: Fixed several other tests.

Posted by vo...@apache.org.
IGNITE-2523: Fixed several other tests.


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

Branch: refs/heads/ignite-2523
Commit: 7e09a146acefccc885e78c57ca85f754d4db5d45
Parents: 0128f98
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 4 10:59:59 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 4 10:59:59 2016 +0300

----------------------------------------------------------------------
 .../IgniteCacheClientNodeChangingTopologyTest.java | 17 ++++++++++++++++-
 ...acheAtomicInvalidPartitionHandlingSelfTest.java |  7 +++++--
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7e09a146/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 13f2598..c83af51 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -61,7 +61,9 @@ import org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContex
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequestInterface;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -231,7 +233,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         // Block messages requests for both nodes.
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
+
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
 
@@ -273,6 +278,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         // Block messages requests for single node.
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
 
         putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -360,10 +366,16 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         // Block messages requests for both nodes.
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
+
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
+
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite2.localNode().id());
 
         spi.record(GridNearAtomicUpdateRequest.class);
+        spi.record(GridNearAtomicSingleUpdateRequest.class);
 
         final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
 
@@ -400,7 +412,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         assertEquals(3, msgs.size());
 
         for (Object msg : msgs)
-            assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());
+            assertTrue(((GridNearAtomicUpdateRequestInterface)msg).clientRequest());
 
         map.put(primaryKey(ignite0.cache(null)), 3);
         map.put(primaryKey(ignite1.cache(null)), 4);
@@ -458,7 +470,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         // Block messages requests for both nodes.
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite0.localNode().id());
+
         spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+        spi.blockMessages(GridNearAtomicSingleUpdateRequest.class, ignite1.localNode().id());
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e09a146/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 74d2d09..c3bd369 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -477,8 +477,11 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
         private boolean delayMessage(GridIoMessage msg) {
             Object origMsg = msg.message();
 
-            return delay &&
-                ((origMsg instanceof GridNearAtomicUpdateRequest) || (origMsg instanceof GridDhtAtomicUpdateRequest));
+            return delay && (
+                (origMsg instanceof GridNearAtomicUpdateRequest) ||
+                (origMsg instanceof GridNearAtomicSingleUpdateRequest) ||
+                (origMsg instanceof GridDhtAtomicUpdateRequest)
+            );
         }
     }
 }
\ No newline at end of file