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:23 UTC
[24/51] [abbrv] ignite git commit: ignite-2523 : finished
generalization of GridNearAtomicUpdate.
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);
}
}