ignite-1607 WIP

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

Branch: refs/heads/ignite-1607
Commit: 59bf1a2e6d77fb888bbdae45efaf9792845dbd39
Parents: 1c9feb1
Author: sboikov <[email protected]>
Authored: Tue Oct 13 11:22:39 2015 +0300
Committer: sboikov <[email protected]>
Committed: Tue Oct 13 17:16:49 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  146 +--
 .../distributed/dht/GridDhtCacheAdapter.java    |    3 -
 .../cache/distributed/dht/GridDhtGetFuture.java |   84 +-
 .../dht/atomic/GridDhtAtomicCache.java          |    1 -
 .../dht/colocated/GridDhtColocatedCache.java    |    8 +-
 .../distributed/near/GridNearAtomicCache.java   |    1 -
 ...arOptimisticSerializableTxPrepareFuture.java |    8 +-
 .../near/GridNearTransactionalCache.java        |    2 -
 .../local/atomic/GridLocalAtomicCache.java      |    2 -
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  128 +-
 .../cache/transactions/IgniteTxLocalEx.java     |   15 +-
 .../CacheSerializableTransactionsTest.java      | 1230 ++++++++++++++++--
 .../cache/CrossCacheTxRandomOperationsTest.java |    6 +
 14 files changed, 1291 insertions(+), 345 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index bb15204..6e5296a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -608,7 +608,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             Collections.singletonList(key),
             /*force primary*/false,
             /*skip tx*/false,
-            /*entry*/null,
             /*subj id*/null,
             /*task name*/null,
             /*deserialize portable*/false,
@@ -643,7 +642,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             keys,
             /*force primary*/false,
             /*skip tx*/false,
-            /*entry*/null,
             /*subj id*/null,
             /*task name*/null,
             /*deserialize portable*/false,
@@ -1298,7 +1296,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             F.asList(key),
             /*force primary*/true,
             /*skip tx*/false,
-            /*cached entry*/null,
             /*subject id*/null,
             taskName,
             /*deserialize cache objects*/true,
@@ -1316,7 +1313,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             /*force primary*/true,
             /*skip tx*/false,
             null,
-            null,
             taskName,
             true,
             false,
@@ -1342,7 +1338,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             F.asList(key),
             /*force primary*/false,
             /*skip tx*/false,
-            /*cached entry*/null,
             /*subject id*/null,
             taskName,
             /*deserialize cache objects*/true,
@@ -1364,7 +1359,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             !ctx.config().isReadFromBackup(),
             /*skip tx*/true,
             null,
-            null,
             taskName,
             !ctx.keepPortable(),
             /*skip values*/false,
@@ -1402,25 +1396,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
     }
 
     /**
-     * @param keys Keys.
-     * @param ret Return flag.
-     * @param skipVals Skip values flag.
-     * @param subjId Subject ID.
-     * @param taskName Task name.
-     * @return Future.
-     */
-    public final IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, 
GridCacheVersion>>> reloadAllAsync0(
-        Collection<KeyCacheObject> keys,
-        boolean ret,
-        boolean skipVals,
-        @Nullable UUID subjId,
-        String taskName) {
-        assert false;
-
-        return new GridFinishedFuture<>();
-    }
-
-    /**
      * @param key Key.
      * @param topVer Topology version.
      * @return Entry.
@@ -1558,7 +1533,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
      * @param keys Keys.
      * @param forcePrimary Force primary.
      * @param skipTx Skip tx.
-     * @param entry Entry.
      * @param subjId Subj Id.
      * @param taskName Task name.
      * @param deserializePortable Deserialize portable.
@@ -1570,7 +1544,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
         @Nullable Collection<? extends K> keys,
         boolean forcePrimary,
         boolean skipTx,
-        @Nullable GridCacheEntryEx entry,
         @Nullable UUID subjId,
         String taskName,
         boolean deserializePortable,
@@ -1583,7 +1556,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return getAllAsync(keys,
             opCtx == null || !opCtx.skipStore(),
-            entry,
             !skipTx,
             subjId,
             taskName,
@@ -1597,7 +1569,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
     /**
      * @param keys Keys.
      * @param readThrough Read through.
-     * @param cached Cached.
      * @param checkTx Check tx.
      * @param subjId Subj Id.
      * @param taskName Task name.
@@ -1610,7 +1581,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
      */
     public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable final 
Collection<? extends K> keys,
         boolean readThrough,
-        @Nullable GridCacheEntryEx cached,
         boolean checkTx,
         @Nullable final UUID subjId,
         final String taskName,
@@ -1902,7 +1872,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
             return asyncOp(tx, new AsyncOp<Map<K1, V1>>(keys) {
                 @Override public IgniteInternalFuture<Map<K1, V1>> 
op(IgniteTxLocalAdapter tx) {
-                    return tx.getAllAsync(ctx, keys, null, 
deserializePortable, skipVals, false, !readThrough);
+                    return tx.getAllAsync(ctx, keys, deserializePortable, 
skipVals, false, !readThrough);
                 }
             });
         }
@@ -1936,7 +1906,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         V prevVal = syncOp(new SyncOp<V>(true) {
             @Override public V op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return (V)tx.putAllAsync(ctx, F.t(key, val), true, null, -1, 
filter).get().value();
+                return (V)tx.putAllAsync(ctx, F.t(key, val), true, 
filter).get().value();
             }
 
             @Override public String toString() {
@@ -1991,7 +1961,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return asyncOp(new AsyncOp<V>() {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter 
tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, 
filter)
+                return tx.putAllAsync(ctx, F.t(key, val), true, filter)
                     
.chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>)RET2VAL);
             }
 
@@ -2030,7 +2000,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         Boolean stored = syncOp(new SyncOp<Boolean>(true) {
             @Override public Boolean op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, 
filter).get().success();
+                return tx.putAllAsync(ctx, F.t(key, val), false, 
filter).get().success();
             }
 
             @Override public String toString() {
@@ -2322,7 +2292,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> 
op(IgniteTxLocalAdapter tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, 
filter).chain(
+                return tx.putAllAsync(ctx, F.t(key, val), false, filter).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
Boolean>) RET2FLAG);
             }
 
@@ -2357,7 +2327,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return syncOp(new SyncOp<V>(true) {
             @Override public V op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return (V)tx.putAllAsync(ctx, F.t(key, val), true, null, -1, 
ctx.noValArray()).get().value();
+                return (V)tx.putAllAsync(ctx, F.t(key, val), true, 
ctx.noValArray()).get().value();
             }
 
             @Override public String toString() {
@@ -2381,7 +2351,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         IgniteInternalFuture<V> fut = asyncOp(new AsyncOp<V>() {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter 
tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, 
ctx.noValArray())
+                return tx.putAllAsync(ctx, F.t(key, val), true, 
ctx.noValArray())
                     
.chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>) RET2VAL);
             }
 
@@ -2411,7 +2381,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         Boolean stored = syncOp(new SyncOp<Boolean>(true) {
             @Override public Boolean op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, 
ctx.noValArray()).get().success();
+                return tx.putAllAsync(ctx, F.t(key, val), false, 
ctx.noValArray()).get().success();
             }
 
             @Override public String toString() {
@@ -2440,7 +2410,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         IgniteInternalFuture<Boolean> fut = asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> 
op(IgniteTxLocalAdapter tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, 
ctx.noValArray()).chain(
+                return tx.putAllAsync(ctx, F.t(key, val), false, 
ctx.noValArray()).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
Boolean>)RET2FLAG);
             }
 
@@ -2466,7 +2436,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return syncOp(new SyncOp<V>(true) {
             @Override public V op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return (V)tx.putAllAsync(ctx, F.t(key, val), true, null, -1, 
ctx.hasValArray()).get().value();
+                return (V)tx.putAllAsync(ctx, F.t(key, val), true, 
ctx.hasValArray()).get().value();
             }
 
             @Override public String toString() {
@@ -2490,7 +2460,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         IgniteInternalFuture<V> fut = asyncOp(new AsyncOp<V>() {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter 
tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, 
ctx.hasValArray()).chain(
+                return tx.putAllAsync(ctx, F.t(key, val), true, 
ctx.hasValArray()).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
V>)RET2VAL);
             }
 
@@ -2516,7 +2486,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return syncOp(new SyncOp<Boolean>(true) {
             @Override public Boolean op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, 
ctx.hasValArray()).get().success();
+                return tx.putAllAsync(ctx, F.t(key, val), false, 
ctx.hasValArray()).get().success();
             }
 
             @Override public String toString() {
@@ -2536,7 +2506,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> 
op(IgniteTxLocalAdapter tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, 
ctx.hasValArray()).chain(
+                return tx.putAllAsync(ctx, F.t(key, val), false, 
ctx.hasValArray()).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
Boolean>) RET2FLAG);
             }
 
@@ -2563,7 +2533,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                 if (ctx.deploymentEnabled())
                     ctx.deploy().registerClass(oldVal);
 
-                return tx.putAllAsync(ctx, F.t(key, newVal), false, null, -1, 
ctx.equalsValArray(oldVal)).get()
+                return tx.putAllAsync(ctx, F.t(key, newVal), false, 
ctx.equalsValArray(oldVal)).get()
                     .success();
             }
 
@@ -2600,7 +2570,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                     }
                 }
 
-                return tx.putAllAsync(ctx, F.t(key, newVal), false, null, -1, 
ctx.equalsValArray(oldVal)).chain(
+                return tx.putAllAsync(ctx, F.t(key, newVal), false, 
ctx.equalsValArray(oldVal)).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
Boolean>)RET2FLAG);
             }
 
@@ -2631,7 +2601,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         syncOp(new SyncInOp(m.size() == 1) {
             @Override public void inOp(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                tx.putAllAsync(ctx, m, false, null, -1, CU.empty0()).get();
+                tx.putAllAsync(ctx, m, false, CU.empty0()).get();
             }
 
             @Override public String toString() {
@@ -2655,7 +2625,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return asyncOp(new AsyncInOp(m.keySet()) {
             @Override public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter 
tx) {
-                return tx.putAllAsync(ctx, m, false, null, -1, 
CU.empty0()).chain(RET2NULL);
+                return tx.putAllAsync(ctx, m, false, 
CU.empty0()).chain(RET2NULL);
             }
 
             @Override public String toString() {
@@ -2677,7 +2647,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         V prevVal = syncOp(new SyncOp<V>(true) {
             @Override public V op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                V ret = tx.removeAllAsync(ctx, Collections.singletonList(key), 
null, true, CU.empty0()).get().value();
+                V ret = tx.removeAllAsync(ctx,
+                    Collections.singletonList(key),
+                    /*retval*/true,
+                    CU.empty0(),
+                    /*singleRmv*/false).get().value();
 
                 if (ctx.config().getInterceptor() != null)
                     return (V)ctx.config().getInterceptor().onBeforeRemove(new 
CacheEntryImpl(key, ret)).get2();
@@ -2710,8 +2684,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
         IgniteInternalFuture<V> fut = asyncOp(new AsyncOp<V>() {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter 
tx) {
                 // TODO should we invoke interceptor here?
-                return tx.removeAllAsync(ctx, Collections.singletonList(key), 
null, true, CU.empty0())
-                    
.chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>) RET2VAL);
+                return tx.removeAllAsync(ctx,
+                    Collections.singletonList(key),
+                    /*retval*/true,
+                    CU.empty0(),
+                    
/*singleRmv*/false).chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
V>)RET2VAL);
             }
 
             @Override public String toString() {
@@ -2757,7 +2734,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         syncOp(new SyncInOp(keys.size() == 1) {
             @Override public void inOp(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                tx.removeAllAsync(ctx, keys, null, false, CU.empty0()).get();
+                tx.removeAllAsync(ctx,
+                    keys,
+                    /*retval*/false,
+                    CU.empty0(),
+                    /*singleRmv*/false).get();
             }
 
             @Override public String toString() {
@@ -2783,7 +2764,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         IgniteInternalFuture<Object> fut = asyncOp(new AsyncInOp(keys) {
             @Override public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter 
tx) {
-                return tx.removeAllAsync(ctx, keys, null, false, 
CU.empty0()).chain(RET2NULL);
+                return tx.removeAllAsync(ctx,
+                    keys,
+                    /*retval*/false,
+                    CU.empty0(),
+                    /*singleRmv*/false).chain(RET2NULL);
             }
 
             @Override public String toString() {
@@ -2810,7 +2795,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         boolean rmv = syncOp(new SyncOp<Boolean>(true) {
             @Override public Boolean op(IgniteTxLocalAdapter tx) throws 
IgniteCheckedException {
-                return tx.removeAllAsync(ctx, Collections.singletonList(key), 
null, false, CU.empty0()).get().success();
+                return tx.removeAllAsync(ctx,
+                    Collections.singletonList(key),
+                    /*retval*/false,
+                    CU.empty0(),
+                    /*singleRmv*/true).get().success();
             }
 
             @Override public String toString() {
@@ -2848,7 +2837,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         IgniteInternalFuture<Boolean> fut = asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> 
op(IgniteTxLocalAdapter tx) {
-                return tx.removeAllAsync(ctx, Collections.singletonList(key), 
null, false, filter).chain(
+                return tx.removeAllAsync(ctx,
+                    Collections.singletonList(key),
+                    /*retval*/false,
+                    filter,
+                    /*singleRmv*/true).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
Boolean>)RET2FLAG);
             }
 
@@ -2878,9 +2871,9 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
                 return tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
-                    null,
-                    true,
-                    ctx.equalsValArray(val)).get();
+                    /*retval*/true,
+                    ctx.equalsValArray(val),
+                    /*singleRmv*/false).get();
             }
 
             @Override public String toString() {
@@ -2945,8 +2938,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                 return tx.putAllAsync(ctx,
                         F.t(key, newVal),
                         true,
-                        null,
-                        -1,
                         ctx.equalsValArray(oldVal)).get();
             }
 
@@ -2974,13 +2965,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                     return new GridFinishedFuture<>(e);
                 }
 
-                IgniteInternalFuture<GridCacheReturn> fut = 
(IgniteInternalFuture)tx.removeAllAsync(ctx,
+                return (IgniteInternalFuture)tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
-                    null,
-                    true,
-                    ctx.equalsValArray(val));
-
-                return fut;
+                    /*retval*/true,
+                    ctx.equalsValArray(val),
+                    /*singleRmv*/false);
             }
 
             @Override public String toString() {
@@ -3008,14 +2997,10 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                     return new GridFinishedFuture<>(e);
                 }
 
-                IgniteInternalFuture<GridCacheReturn> fut = 
(IgniteInternalFuture)tx.putAllAsync(ctx,
+                return (IgniteInternalFuture)tx.putAllAsync(ctx,
                     F.t(key, newVal),
                     true,
-                    null,
-                    -1,
                     ctx.equalsValArray(oldVal));
-
-                return fut;
             }
 
             @Override public String toString() {
@@ -3043,8 +3028,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                 if (ctx.deploymentEnabled())
                     ctx.deploy().registerClass(val);
 
-                return tx.removeAllAsync(ctx, Collections.singletonList(key), 
null, false,
-                    ctx.equalsValArray(val)).get().success();
+                return tx.removeAllAsync(ctx,
+                    Collections.singletonList(key),
+                    /*retval*/false,
+                    ctx.equalsValArray(val),
+                    /*singleRmv*/false).get().success();
             }
 
             @Override public String toString() {
@@ -3083,8 +3071,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
                     }
                 }
 
-                return tx.removeAllAsync(ctx, Collections.singletonList(key), 
null, false,
-                    ctx.equalsValArray(val)).chain(
+                return tx.removeAllAsync(ctx,
+                    Collections.singletonList(key),
+                    /*retval*/false,
+                    ctx.equalsValArray(val),
+                    /*singleRmv*/false).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, 
Boolean>)RET2FLAG);
             }
 
@@ -3108,7 +3099,11 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         return asyncOp(new AsyncInOp(keys) {
             @Override public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter 
tx) {
-                return tx.removeAllAsync(ctx, keys, null, false, null);
+                return tx.removeAllAsync(ctx,
+                    keys,
+                    /*retval*/false,
+                    null,
+                    /*singleRmv*/false);
             }
 
             @Override public String toString() {
@@ -4493,7 +4488,6 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
             !ctx.config().isReadFromBackup(),
             /*skip tx*/false,
             null,
-            null,
             taskName,
             deserializePortable,
             false,

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 25e480c..27991df 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -575,7 +575,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends 
GridDistributedCacheAdap
         @Nullable Collection<? extends K> keys,
         boolean forcePrimary,
         boolean skipTx,
-        @Nullable GridCacheEntryEx entry,
         @Nullable UUID subjId,
         String taskName,
         boolean deserializePortable,
@@ -586,7 +585,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends 
GridDistributedCacheAdap
 
         return getAllAsync(keys,
             opCtx == null || !opCtx.skipStore(),
-            null,
             /*don't check local tx. */false,
             subjId,
             taskName,
@@ -655,7 +653,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends 
GridDistributedCacheAdap
             reader,
             keys,
             readThrough,
-            reload,
             /*tx*/null,
             topVer,
             subjId,

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index e8cafb0..1e722ba 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -72,9 +72,6 @@ public final class GridDhtGetFuture<K, V> extends 
GridCompoundIdentityFuture<Col
     /** */
     private UUID reader;
 
-    /** Reload flag. */
-    private boolean reload;
-
     /** Read through flag. */
     private boolean readThrough;
 
@@ -120,7 +117,6 @@ public final class GridDhtGetFuture<K, V> extends 
GridCompoundIdentityFuture<Col
      * @param reader Reader.
      * @param keys Keys.
      * @param readThrough Read through flag.
-     * @param reload Reload flag.
      * @param tx Transaction.
      * @param topVer Topology version.
      * @param subjId Subject ID.
@@ -134,7 +130,6 @@ public final class GridDhtGetFuture<K, V> extends 
GridCompoundIdentityFuture<Col
         UUID reader,
         LinkedHashMap<KeyCacheObject, Boolean> keys,
         boolean readThrough,
-        boolean reload,
         @Nullable IgniteTxLocalEx tx,
         @NotNull AffinityTopologyVersion topVer,
         @Nullable UUID subjId,
@@ -147,14 +142,11 @@ public final class GridDhtGetFuture<K, V> extends 
GridCompoundIdentityFuture<Col
         assert reader != null;
         assert !F.isEmpty(keys);
 
-        assert !reload;
-
         this.reader = reader;
         this.cctx = cctx;
         this.msgId = msgId;
         this.keys = keys;
         this.readThrough = readThrough;
-        this.reload = reload;
         this.tx = tx;
         this.topVer = topVer;
         this.subjId = subjId;
@@ -356,33 +348,23 @@ public final class GridDhtGetFuture<K, V> extends 
GridCompoundIdentityFuture<Col
         IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, 
GridCacheVersion>>> fut;
 
         if (txFut == null || txFut.isDone()) {
-            if (reload && cctx.readThrough() && cctx.store().configured()) {
-                fut = cache().reloadAllAsync0(keys.keySet(),
-                    true,
-                    skipVals,
+            if (tx == null) {
+                fut = cache().getDhtAllAsync(
+                    keys.keySet(),
+                    readThrough,
                     subjId,
-                    taskName);
+                    taskName,
+                    expiryPlc,
+                    skipVals,
+                    /*can remap*/true);
             }
             else {
-                if (tx == null) {
-                    fut = cache().getDhtAllAsync(
-                        keys.keySet(),
-                        readThrough,
-                        subjId,
-                        taskName,
-                        expiryPlc,
-                        skipVals,
-                        /*can remap*/true);
-                }
-                else {
-                    fut = tx.getAllAsync(cctx,
-                        keys.keySet(),
-                        null,
-                        /*deserialize portable*/false,
-                        skipVals,
-                        /*keep cache objects*/true,
-                        /*skip store*/!readThrough);
-                }
+                fut = tx.getAllAsync(cctx,
+                    keys.keySet(),
+                    /*deserialize portable*/false,
+                    skipVals,
+                    /*keep cache objects*/true,
+                    /*skip store*/!readThrough);
             }
         }
         else {
@@ -396,33 +378,23 @@ public final class GridDhtGetFuture<K, V> extends 
GridCompoundIdentityFuture<Col
                         if (e != null)
                             throw new GridClosureException(e);
 
-                        if (reload && cctx.readThrough() && 
cctx.store().configured()) {
-                            return cache().reloadAllAsync0(keys.keySet(),
-                                true,
-                                skipVals,
+                        if (tx == null) {
+                            return cache().getDhtAllAsync(
+                                keys.keySet(),
+                                readThrough,
                                 subjId,
-                                taskName);
+                                taskName,
+                                expiryPlc,
+                                skipVals,
+                                /*can remap*/true);
                         }
                         else {
-                            if (tx == null) {
-                                return cache().getDhtAllAsync(
-                                    keys.keySet(),
-                                    readThrough,
-                                    subjId,
-                                    taskName,
-                                    expiryPlc,
-                                    skipVals,
-                                    /*can remap*/true);
-                            }
-                            else {
-                                return tx.getAllAsync(cctx,
-                                    keys.keySet(),
-                                    null,
-                                    /*deserialize portable*/false,
-                                    skipVals,
-                                    /*keep cache objects*/true,
-                                    /*skip store*/!readThrough);
-                            }
+                            return tx.getAllAsync(cctx,
+                                keys.keySet(),
+                                /*deserialize portable*/false,
+                                skipVals,
+                                /*keep cache objects*/true,
+                                /*skip store*/!readThrough);
                         }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/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 6971b85..14abc4b 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
@@ -306,7 +306,6 @@ public class GridDhtAtomicCache<K, V> extends 
GridDhtCacheAdapter<K, V> {
         @Nullable final Collection<? extends K> keys,
         final boolean forcePrimary,
         boolean skipTx,
-        @Nullable final GridCacheEntryEx entry,
         @Nullable UUID subjId,
         final String taskName,
         final boolean deserializePortable,

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index fd43053..eab68b1 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -190,7 +190,6 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
         @Nullable final Collection<? extends K> keys,
         boolean forcePrimary,
         boolean skipTx,
-        @Nullable final GridCacheEntryEx entry,
         @Nullable UUID subjId,
         String taskName,
         final boolean deserializePortable,
@@ -214,7 +213,6 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
                 @Override public IgniteInternalFuture<Map<K, V>> 
op(IgniteTxLocalAdapter tx) {
                     return tx.getAllAsync(ctx,
                         ctx.cacheKeysView(keys),
-                        entry,
                         deserializePortable,
                         skipVals,
                         false,
@@ -332,7 +330,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
         // Optimisation: try to resolve value locally and escape 'get future' 
creation.
         if (!reload && !forcePrimary) {
             Map<K, V> locVals = null;
-            Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> locVals0 = 
null;
+            Map<KeyCacheObject, T2<Object, GridCacheVersion>> locVals0 = null;
 
             boolean success = true;
 
@@ -397,7 +395,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
                                     if (locVals0 == null)
                                         locVals0 = U.newHashMap(keys.size());
 
-                                    locVals0.put(key, new T2<>(v, ver));
+                                    locVals0.put(key, new 
T2<>((Object)(skipVals ? true : v), ver));
                                 }
                                 else {
                                     if (locVals == null)
@@ -444,7 +442,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
 
                 if (c != null) {
                     if (locVals0 != null) {
-                        for (Map.Entry<KeyCacheObject, T2<CacheObject, 
GridCacheVersion>> e : locVals0.entrySet())
+                        for (Map.Entry<KeyCacheObject, T2<Object, 
GridCacheVersion>> e : locVals0.entrySet())
                             c.apply(e.getKey(), e.getValue().get1(), 
e.getValue().get2());
                     }
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/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 82054d9..1d352f6 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
@@ -385,7 +385,6 @@ public class GridNearAtomicCache<K, V> extends 
GridNearCacheAdapter<K, V> {
         @Nullable Collection<? extends K> keys,
         boolean forcePrimary,
         boolean skipTx,
-        @Nullable GridCacheEntryEx entry,
         @Nullable UUID subjId,
         String taskName,
         boolean deserializePortable,

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 8d6042c..0b43eb3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -473,12 +473,12 @@ public class 
GridNearOptimisticSerializableTxPrepareFuture extends GridNearTxPre
 
         Map<IgniteBiTuple<ClusterNode, Boolean>, GridDistributedTxMapping> 
mappings = new HashMap<>();
 
-        for (IgniteTxEntry read : reads)
-            map(read, topVer, mappings, false, remap);
-
         for (IgniteTxEntry write : writes)
             map(write, topVer, mappings, true, remap);
 
+        for (IgniteTxEntry read : reads)
+            map(read, topVer, mappings, false, remap);
+
         keyLockFut.onAllKeysAdded();
 
         if (!remap)
@@ -586,7 +586,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture 
extends GridNearTxPre
         // Must lock near entries separately.
         if (m.near()) {
             try {
-                tx.optimisticLockEntries(m.entries());
+                tx.optimisticLockEntries(F.concat(false, m.writes(), 
m.reads()));
 
                 tx.userPrepare();
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
index 37f63db..7700f05 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
@@ -118,7 +118,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
         @Nullable final Collection<? extends K> keys,
         boolean forcePrimary,
         boolean skipTx,
-        @Nullable final GridCacheEntryEx entry,
         @Nullable UUID subjId,
         String taskName,
         final boolean deserializePortable,
@@ -144,7 +143,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
                 @Override public IgniteInternalFuture<Map<K, V>> 
op(IgniteTxLocalAdapter tx) {
                     return tx.getAllAsync(ctx,
                         ctx.cacheKeysView(keys),
-                        entry,
                         deserializePortable,
                         skipVals,
                         false,

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 0bf6ea2..7c1e3d1 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -495,7 +495,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
         @Nullable final Collection<? extends K> keys,
         final boolean forcePrimary,
         boolean skipTx,
-        @Nullable final GridCacheEntryEx entry,
         @Nullable UUID subjId,
         final String taskName,
         final boolean deserializePortable,
@@ -615,7 +614,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
         return getAllAsync(
             keys,
             opCtx == null || !opCtx.skipStore(),
-            null,
             false,
             subjId,
             taskName,

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index a211058..cc2db03 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -433,7 +433,7 @@ public abstract class IgniteTxAdapter extends 
GridMetadataAwareAdapter
     /** {@inheritDoc} */
     @Override public Collection<IgniteTxEntry> optimisticLockEntries() {
         if (optimistic() && serializable())
-            return allEntries();
+            return F.concat(false, writeEntries(), readEntries());
 
         return writeEntries();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 938ed5e..56a50f9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1306,11 +1306,10 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
 
     /**
      * Checks if there is a cached or swapped value for
-     * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, 
boolean, boolean, boolean, boolean)} method.
+     * {@link #getAllAsync(GridCacheContext, Collection, boolean, boolean, 
boolean, boolean)} method.
      *
      * @param cacheCtx Cache context.
      * @param keys Key to enlist.
-     * @param cached Cached entry, if called from entry wrapper.
      * @param expiryPlc Explicitly specified expiry policy for entry.
      * @param map Return map.
      * @param missed Map of missed keys.
@@ -1326,7 +1325,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
     private <K, V> Collection<KeyCacheObject> enlistRead(
         final GridCacheContext cacheCtx,
         Collection<KeyCacheObject> keys,
-        @Nullable GridCacheEntryEx cached,
         @Nullable ExpiryPolicy expiryPlc,
         Map<K, V> map,
         Map<KeyCacheObject, GridCacheVersion> missed,
@@ -1338,7 +1336,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
     ) throws IgniteCheckedException {
         assert !F.isEmpty(keys);
         assert keysCnt == keys.size();
-        assert cached == null || F.first(keys).equals(cached.key());
 
         cacheCtx.checkSecurity(SecurityPermission.CACHE_READ);
 
@@ -1438,15 +1435,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                     lockKeys.add(key);
 
                 while (true) {
-                    GridCacheEntryEx entry;
-
-                    if (cached != null) {
-                        entry = cached;
-
-                        cached = null;
-                    }
-                    else
-                        entry = entryEx(cacheCtx, txKey, topVer);
+                    GridCacheEntryEx entry = entryEx(cacheCtx, txKey, topVer);
 
                     try {
                         GridCacheVersion ver = entry.version();
@@ -1625,7 +1614,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
 
     /**
      * Loads all missed keys for
-     * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, 
boolean, boolean, boolean, boolean)} method.
+     * {@link #getAllAsync(GridCacheContext, Collection, boolean, boolean, 
boolean, boolean)} method.
      *
      * @param cacheCtx Cache context.
      * @param map Return map.
@@ -1747,7 +1736,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
     @Override public <K, V> IgniteInternalFuture<Map<K, V>> getAllAsync(
         final GridCacheContext cacheCtx,
         Collection<KeyCacheObject> keys,
-        @Nullable GridCacheEntryEx cached,
         final boolean deserializePortable,
         final boolean skipVals,
         final boolean keepCacheObjects,
@@ -1774,7 +1762,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
 
             final Collection<KeyCacheObject> lockKeys = enlistRead(cacheCtx,
                 keys,
-                cached,
                 expiryPlc,
                 retMap,
                 missed,
@@ -1986,8 +1973,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
         GridCacheContext cacheCtx,
         Map<? extends K, ? extends V> map,
         boolean retval,
-        @Nullable GridCacheEntryEx cached,
-        long ttl,
         CacheEntryPredicate[] filter
     ) {
         return (IgniteInternalFuture<GridCacheReturn>)putAllAsync0(cacheCtx,
@@ -1996,7 +1981,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             null,
             null,
             retval,
-            cached,
             filter);
     }
 
@@ -2011,7 +1995,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             null,
             drMap,
             false,
-            null,
             null);
     }
 
@@ -2028,7 +2011,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             invokeArgs,
             null,
             true,
-            null,
             null);
     }
 
@@ -2037,7 +2019,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
         GridCacheContext cacheCtx,
         Map<KeyCacheObject, GridCacheVersion> drMap
     ) {
-        return removeAllAsync0(cacheCtx, null, drMap, null, false, null);
+        return removeAllAsync0(cacheCtx, null, drMap, false, null, false);
     }
 
     /**
@@ -2062,7 +2044,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
      *
      * @param cacheCtx Cache context.
      * @param keys Keys to enlist.
-     * @param cached Cached entry.
      * @param expiryPlc Explicitly specified expiry policy for entry.
      * @param implicit Implicit flag.
      * @param lookup Value lookup map ({@code null} for remove).
@@ -2081,23 +2062,21 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
     private <K, V> IgniteInternalFuture<Set<KeyCacheObject>> enlistWrite(
         final GridCacheContext cacheCtx,
         Collection<?> keys,
-        @Nullable GridCacheEntryEx cached,
         @Nullable ExpiryPolicy expiryPlc,
         boolean implicit,
         @Nullable Map<?, ?> lookup,
         @Nullable Map<?, EntryProcessor<K, V, Object>> invokeMap,
         @Nullable Object[] invokeArgs,
-        boolean retval,
+        final boolean retval,
         boolean lockOnly,
         final CacheEntryPredicate[] filter,
         final GridCacheReturn ret,
         Collection<KeyCacheObject> enlisted,
         @Nullable Map<KeyCacheObject, GridCacheDrInfo> drPutMap,
         @Nullable Map<KeyCacheObject, GridCacheVersion> drRmvMap,
-        boolean skipStore
+        boolean skipStore,
+        final boolean singleRmv
     ) {
-        assert cached == null || keys.size() == 1;
-        assert cached == null || F.first(keys).equals(cached.key());
         assert retval || invokeMap == null;
 
         try {
@@ -2114,7 +2093,8 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
         Set<KeyCacheObject> missedForLoad = null;
 
         final boolean hasFilters = !F.isEmptyOrNulls(filter) && 
!F.isAlwaysTrue(filter);
-        final boolean needReadVer = (retval || hasFilters) && (optimistic() && 
serializable());
+        final boolean needVal = singleRmv || retval || hasFilters;
+        final boolean needReadVer = needVal && (optimistic() && 
serializable());
 
         try {
             // Set transform flag for transaction.
@@ -2172,19 +2152,10 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                 // First time access.
                 if (txEntry == null) {
                     while (true) {
-                        GridCacheEntryEx entry = null;
+                        GridCacheEntryEx entry = entryEx(cacheCtx, txKey, 
topologyVersion());
 
                         try {
-                            if (cached != null) {
-                                entry = cached;
-
-                                cached = null;
-                            }
-                            else {
-                                entry = entryEx(cacheCtx, txKey, 
topologyVersion());
-
-                                entry.unswap(false);
-                            }
+                            entry.unswap(false);
 
                             // Check if lock is being explicitly acquired by 
the same thread.
                             if (!implicit && 
cctx.kernalContext().config().isCacheSanityCheckEnabled() &&
@@ -2305,9 +2276,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                                 txEntry.markValid();
 
                                 if (old == null) {
-                                    boolean load = retval || hasFilters;
-
-                                    if (load) {
+                                    if (needVal) {
                                         if (missedForLoad == null)
                                             missedForLoad = new HashSet<>();
 
@@ -2445,13 +2414,15 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
         }
 
         if (missedForLoad != null) {
+            final boolean skipVals = singleRmv;
+
             IgniteInternalFuture<Void> fut = loadMissing(
                 cacheCtx,
                 /*read through*/cacheCtx.config().isLoadPreviousValue() && 
!skipStore,
                 /*async*/true,
                 missedForLoad,
                 deserializePortables(cacheCtx),
-                /*skip values*/false,
+                skipVals,
                 needReadVer,
                 new GridInClosure3<KeyCacheObject, Object, GridCacheVersion>() 
{
                     @Override public void apply(KeyCacheObject key,
@@ -2470,29 +2441,37 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                             e.serializableReadVersion(loadVer);
                         }
 
-                        CacheObject cacheVal = cacheCtx.toCacheObject(val);
+                        if (singleRmv) {
+                            assert !hasFilters && !retval;
+                            assert val == null || Boolean.TRUE.equals(val) : 
val;
 
-                        if (e.op() == TRANSFORM) {
-                            GridCacheVersion ver;
+                            ret.set(cacheCtx, null, val != null);
+                        }
+                        else {
+                            CacheObject cacheVal = cacheCtx.toCacheObject(val);
 
-                            try {
-                                ver = e.cached().version();
-                            }
-                            catch (GridCacheEntryRemovedException ex) {
-                                assert optimistic() : e;
+                            if (e.op() == TRANSFORM) {
+                                GridCacheVersion ver;
 
-                                if (log.isDebugEnabled())
-                                    log.debug("Failed to get entry version: 
[msg=" + ex.getMessage() + ']');
+                                try {
+                                    ver = e.cached().version();
+                                }
+                                catch (GridCacheEntryRemovedException ex) {
+                                    assert optimistic() : e;
 
-                                ver = null;
-                            }
+                                    if (log.isDebugEnabled())
+                                        log.debug("Failed to get entry 
version: [msg=" + ex.getMessage() + ']');
 
-                            addInvokeResult(e, cacheVal, ret, ver);
-                        }
-                        else {
-                            boolean success = hasFilters ? isAll(e.context(), 
key, cacheVal, filter) : true;
+                                    ver = null;
+                                }
+
+                                addInvokeResult(e, cacheVal, ret, ver);
+                            }
+                            else {
+                                boolean success = !hasFilters || 
isAll(e.context(), key, cacheVal, filter);
 
-                            ret.set(cacheCtx, cacheVal, success);
+                                ret.set(cacheCtx, cacheVal, success);
+                            }
                         }
                     }
                 });
@@ -2768,7 +2747,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
      * @param invokeArgs Optional arguments for EntryProcessor.
      * @param drMap DR map.
      * @param retval Key-transform value map to store.
-     * @param cached Cached entry, if any.
      * @param filter Filter.
      * @return Operation future.
      */
@@ -2780,7 +2758,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
         @Nullable final Object[] invokeArgs,
         @Nullable final Map<KeyCacheObject, GridCacheDrInfo> drMap,
         final boolean retval,
-        @Nullable GridCacheEntryEx cached,
         @Nullable final CacheEntryPredicate[] filter
     ) {
         assert filter == null || invokeMap == null;
@@ -2821,8 +2798,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             log.debug("Called putAllAsync(...) [tx=" + this + ", map=" + map0 
+ ", retval=" + retval + "]");
 
         assert map0 != null || invokeMap0 != null;
-        assert cached == null ||
-            (map0 != null && map0.size() == 1) || (invokeMap0 != null && 
invokeMap0.size() == 1);
 
         try {
             checkValid();
@@ -2857,7 +2832,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             final IgniteInternalFuture<Set<KeyCacheObject>> loadFut = 
enlistWrite(
                 cacheCtx,
                 keySet,
-                cached,
                 opCtx != null ? opCtx.expiry() : null,
                 implicit,
                 map0,
@@ -2870,7 +2844,8 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                 enlisted,
                 drMap,
                 null,
-                opCtx != null && opCtx.skipStore());
+                opCtx != null && opCtx.skipStore(),
+                false);
 
             if (pessimistic()) {
                 // Loose all skipped.
@@ -2964,8 +2939,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                 }
                 else
                     return nonInterruptable(loadFut.chain(new 
CX1<IgniteInternalFuture<Set<KeyCacheObject>>, GridCacheReturn>() {
-                        @Override
-                        public GridCacheReturn 
applyx(IgniteInternalFuture<Set<KeyCacheObject>> f) throws 
IgniteCheckedException {
+                        @Override public GridCacheReturn 
applyx(IgniteInternalFuture<Set<KeyCacheObject>> f) throws 
IgniteCheckedException {
                             f.get();
 
                             return ret;
@@ -2994,11 +2968,11 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
     @Override public <K, V> IgniteInternalFuture<GridCacheReturn> 
removeAllAsync(
         GridCacheContext cacheCtx,
         Collection<? extends K> keys,
-        @Nullable GridCacheEntryEx cached,
         boolean retval,
-        CacheEntryPredicate[] filter
+        CacheEntryPredicate[] filter,
+        boolean singleRmv
     ) {
-        return removeAllAsync0(cacheCtx, keys, null, cached, retval, filter);
+        return removeAllAsync0(cacheCtx, keys, null, retval, filter, 
singleRmv);
     }
 
     /**
@@ -3006,7 +2980,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
      * @param keys Keys to remove.
      * @param drMap DR map.
      * @param retval Flag indicating whether a value should be returned.
-     * @param cached Cached entry, if any. Will be provided only if size of 
keys collection is 1.
      * @param filter Filter.
      * @return Future for asynchronous remove.
      */
@@ -3015,9 +2988,9 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
         final GridCacheContext cacheCtx,
         @Nullable final Collection<? extends K> keys,
         @Nullable Map<KeyCacheObject, GridCacheVersion> drMap,
-        @Nullable GridCacheEntryEx cached,
         final boolean retval,
-        @Nullable final CacheEntryPredicate[] filter) {
+        @Nullable final CacheEntryPredicate[] filter,
+        boolean singleRmv) {
         try {
             checkUpdatesAllowed(cacheCtx);
         }
@@ -3041,7 +3014,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             keys0 = keys;
 
         assert keys0 != null;
-        assert cached == null || keys0.size() == 1;
 
         if (log.isDebugEnabled())
             log.debug("Called removeAllAsync(...) [tx=" + this + ", keys=" + 
keys0 + ", implicit=" + implicit +
@@ -3086,7 +3058,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             final IgniteInternalFuture<Set<KeyCacheObject>> loadFut = 
enlistWrite(
                 cacheCtx,
                 keys0,
-                /** cached entry */null,
                 plc,
                 implicit,
                 /** lookup map */null,
@@ -3099,7 +3070,8 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                 enlisted,
                 null,
                 drMap,
-                opCtx != null && opCtx.skipStore()
+                opCtx != null && opCtx.skipStore(),
+                singleRmv
             );
 
             if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/ignite/blob/59bf1a2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
index 55d0dbb..1530aeb 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
@@ -19,6 +19,7 @@ package 
org.apache.ignite.internal.processors.cache.transactions;
 
 import java.util.Collection;
 import java.util.Map;
+import javax.cache.Cache;
 import javax.cache.processor.EntryProcessor;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
@@ -65,8 +66,6 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
     /**
      * @param cacheCtx Cache context.
      * @param keys Keys to get.
-     * @param cached Cached entry if this method is called from entry wrapper
-     *      Cached entry is passed if and only if there is only one key in 
collection of keys.
      * @param deserializePortable Deserialize portable flag.
      * @param skipVals Skip values flag.
      * @param keepCacheObjects Keep cache objects
@@ -76,7 +75,6 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
     public <K, V> IgniteInternalFuture<Map<K, V>> getAllAsync(
         GridCacheContext cacheCtx,
         Collection<KeyCacheObject> keys,
-        @Nullable GridCacheEntryEx cached,
         boolean deserializePortable,
         boolean skipVals,
         boolean keepCacheObjects,
@@ -86,17 +84,13 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
      * @param cacheCtx Cache context.
      * @param map Map to put.
      * @param retval Flag indicating whether a value should be returned.
-     * @param cached Cached entry, if any. Will be provided only if map has 
size 1.
      * @param filter Filter.
-     * @param ttl Time to live for entry. If negative, leave unchanged.
      * @return Future for put operation.
      */
     public <K, V> IgniteInternalFuture<GridCacheReturn> putAllAsync(
         GridCacheContext cacheCtx,
         Map<? extends K, ? extends V> map,
         boolean retval,
-        @Nullable GridCacheEntryEx cached,
-        long ttl,
         CacheEntryPredicate[] filter);
 
     /**
@@ -114,16 +108,16 @@ public interface IgniteTxLocalEx extends IgniteInternalTx 
{
      * @param cacheCtx Cache context.
      * @param keys Keys to remove.
      * @param retval Flag indicating whether a value should be returned.
-     * @param cached Cached entry, if any. Will be provided only if size of 
keys collection is 1.
      * @param filter Filter.
+     * @param singleRmv {@code True} for single key remove operation ({@link 
Cache#remove(Object)}.
      * @return Future for asynchronous remove.
      */
     public <K, V> IgniteInternalFuture<GridCacheReturn> removeAllAsync(
         GridCacheContext cacheCtx,
         Collection<? extends K> keys,
-        @Nullable GridCacheEntryEx cached,
         boolean retval,
-        CacheEntryPredicate[] filter);
+        CacheEntryPredicate[] filter,
+        boolean singleRmv);
 
     /**
      * @param cacheCtx Cache context.
@@ -162,7 +156,6 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
      * @param readThrough Read through flag.
      * @param async if {@code True}, then loading will happen in a separate 
thread.
      * @param keys Keys.
-     * @param c Closure.
      * @param deserializePortable Deserialize portable flag.
      * @param skipVals Skip values flag.
      * @param needVer If {@code true} version is required for loaded values.

Reply via email to