This is an automated email from the ASF dual-hosted git repository.

av pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 18dc08f7e00 IGNITE-20176 GridNearTxAbstractEnlistFuture and it's 
descendants initial cleanup (#10882)
18dc08f7e00 is described below

commit 18dc08f7e00fef4e8e6225e4d06c6c4b49b8cd0f
Author: Anton Vinogradov <a...@apache.org>
AuthorDate: Wed Aug 9 13:02:55 2023 +0300

    IGNITE-20176 GridNearTxAbstractEnlistFuture and it's descendants initial 
cleanup (#10882)
---
 .../dht/GridDhtTransactionalCacheAdapter.java      |  2 +-
 .../near/GridNearTxAbstractEnlistFuture.java       | 31 +++++------
 .../distributed/near/GridNearTxEnlistFuture.java   | 51 ++++++++----------
 .../near/GridNearTxQueryAbstractEnlistFuture.java  |  2 +-
 .../near/GridNearTxQueryEnlistFuture.java          | 63 +++++++++++-----------
 .../near/GridNearTxQueryResultsEnlistFuture.java   | 53 +++++++++---------
 6 files changed, 93 insertions(+), 109 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 427e78b1076..2fb2a0f4d1a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -2194,7 +2194,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
         GridNearTxQueryEnlistFuture fut = 
(GridNearTxQueryEnlistFuture)ctx.mvcc().versionedFuture(res.version(), 
res.futureId());
 
         if (fut != null)
-            fut.onResult(nodeId, res);
+            fut.onResult(res);
     }
 
     /**
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
index 5e549521161..fa440d0b65e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
@@ -45,7 +45,6 @@ import 
org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteReducer;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.NotNull;
@@ -78,7 +77,7 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
     protected final IgniteLogger log;
 
     /** */
-    protected long timeout;
+    private final long timeout;
 
     /** Initiated thread id. */
     protected final long threadId;
@@ -91,7 +90,7 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
 
     /** */
     @GridToStringExclude
-    private GridDhtTxAbstractEnlistFuture localEnlistFuture;
+    private GridDhtTxAbstractEnlistFuture locEnlistFut;
 
     /** */
     @SuppressWarnings("unused")
@@ -100,7 +99,7 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
 
     /** Timeout object. */
     @GridToStringExclude
-    protected LockTimeoutObject timeoutObj;
+    private LockTimeoutObject timeoutObj;
 
     /**
      * @param cctx Cache context.
@@ -108,7 +107,7 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
      * @param timeout Timeout.
      * @param rdc Compound future reducer.
      */
-    public GridNearTxAbstractEnlistFuture(
+    protected GridNearTxAbstractEnlistFuture(
         GridCacheContext<?, ?> cctx, GridNearTxLocal tx, long timeout, 
@Nullable IgniteReducer<T, T> rdc) {
         super(rdc);
 
@@ -158,11 +157,9 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
 
                 // Terminate this future if parent future is terminated by 
rollback.
                 if (!fut.isDone()) {
-                    fut.listen(new IgniteInClosure<IgniteInternalFuture>() {
-                        @Override public void apply(IgniteInternalFuture fut) {
-                            if (fut.error() != null)
-                                onDone(fut.error());
-                        }
+                    fut.listen((IgniteInternalFuture fut0) -> {
+                        if (fut0.error() != null)
+                            onDone(fut0.error());
                     });
                 }
                 else if (fut.error() != null)
@@ -277,9 +274,9 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
     protected synchronized void 
updateLocalFuture(GridDhtTxAbstractEnlistFuture fut) throws 
IgniteCheckedException {
         checkCompleted();
 
-        assert localEnlistFuture == null;
+        assert locEnlistFut == null;
 
-        localEnlistFuture = fut;
+        locEnlistFut = fut;
     }
 
     /**
@@ -289,8 +286,8 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
     protected synchronized void clearLocalFuture(GridDhtTxAbstractEnlistFuture 
fut) throws IgniteCheckedException {
         checkCompleted();
 
-        if (localEnlistFuture == fut)
-            localEnlistFuture = null;
+        if (locEnlistFut == fut)
+            locEnlistFut = null;
     }
 
     /**
@@ -376,10 +373,10 @@ public abstract class GridNearTxAbstractEnlistFuture<T> 
extends GridCacheCompoun
             tx.setRollbackOnly();
 
         synchronized (this) {
-            GridDhtTxAbstractEnlistFuture localFuture0 = localEnlistFuture;
+            GridDhtTxAbstractEnlistFuture locFut0 = locEnlistFut;
 
-            if (localFuture0 != null && (err != null || cancelled))
-                localFuture0.onDone(cancelled ? new 
IgniteFutureCancelledCheckedException("Future was cancelled: " + localFuture0) 
: err);
+            if (locFut0 != null && (err != null || cancelled))
+                locFut0.onDone(cancelled ? new 
IgniteFutureCancelledCheckedException("Future was cancelled: " + locFut0) : 
err);
 
             boolean done = super.onDone(res, err, cancelled);
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxEnlistFuture.java
index ef50f612590..4cd99d6ac35 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxEnlistFuture.java
@@ -39,7 +39,6 @@ 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.KeyCacheObject;
-import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxAbstractEnlistFuture;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxEnlistFuture;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshotWithoutTxs;
@@ -49,11 +48,9 @@ import 
org.apache.ignite.internal.processors.query.UpdateSourceIterator;
 import org.apache.ignite.internal.processors.security.SecurityUtils;
 import 
org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.CI1;
 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.S;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.jetbrains.annotations.Nullable;
@@ -86,10 +83,10 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
     private final UpdateSourceIterator<?> it;
 
     /** Batch size. */
-    private int batchSize;
+    private final int batchSize;
 
     /** */
-    private AtomicInteger batchCntr = new AtomicInteger();
+    private final AtomicInteger batchCntr = new AtomicInteger();
 
     /** */
     @SuppressWarnings("unused")
@@ -223,7 +220,7 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
 
                 Object cur = next0();
 
-                KeyCacheObject key = cctx.toCacheKeyObject(op.isDeleteOrLock() 
? cur : ((IgniteBiTuple)cur).getKey());
+                KeyCacheObject key = cctx.toCacheKeyObject(op.isDeleteOrLock() 
? cur : ((Map.Entry<?, ?>)cur).getKey());
 
                 ClusterNode node = cctx.affinity().primaryByKey(key, topVer);
 
@@ -361,12 +358,12 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
             if (keysOnly)
                 keys.add(cctx.toCacheKeyObject(row));
             else {
-                keys.add(cctx.toCacheKeyObject(((IgniteBiTuple)row).getKey()));
+                keys.add(cctx.toCacheKeyObject(((Map.Entry<?, 
?>)row).getKey()));
 
                 if (op.isInvoke())
-                    vals.add((Message)((IgniteBiTuple)row).getValue());
+                    vals.add((Message)((Map.Entry<?, ?>)row).getValue());
                 else
-                    
vals.add(cctx.toCacheObject(((IgniteBiTuple)row).getValue()));
+                    vals.add(cctx.toCacheObject(((Map.Entry<?, 
?>)row).getValue()));
             }
         }
 
@@ -503,22 +500,20 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
 
         updateLocalFuture(fut);
 
-        fut.listen(new CI1<IgniteInternalFuture<GridCacheReturn>>() {
-            @Override public void apply(IgniteInternalFuture<GridCacheReturn> 
fut) {
-                try {
-                    clearLocalFuture((GridDhtTxAbstractEnlistFuture)fut);
+        fut.listen((IgniteInternalFuture<GridCacheReturn> fut0) -> {
+            try {
+                clearLocalFuture(fut);
 
-                    GridNearTxEnlistResponse res = fut.error() == null ? 
createResponse(fut) : null;
+                GridNearTxEnlistResponse res = fut.error() == null ? 
createResponse(fut) : null;
 
-                    if (checkResponse(nodeId, res, fut.error()))
-                        sendNextBatches(nodeId);
-                }
-                catch (IgniteCheckedException e) {
-                    checkResponse(nodeId, null, e);
-                }
-                finally {
-                    CU.unwindEvicts(cctx);
-                }
+                if (checkResponse(nodeId, res, fut.error()))
+                    sendNextBatches(nodeId);
+            }
+            catch (IgniteCheckedException e) {
+                checkResponse(nodeId, null, e);
+            }
+            finally {
+                CU.unwindEvicts(cctx);
             }
         });
 
@@ -543,7 +538,7 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
 
     /** {@inheritDoc} */
     @Override public boolean onNodeLeft(UUID nodeId) {
-        if (batches.keySet().contains(nodeId)) {
+        if (batches.containsKey(nodeId)) {
             if (log.isDebugEnabled())
                 log.debug("Found unacknowledged batch for left node [nodeId=" 
+ nodeId + ", fut=" +
                     this + ']');
@@ -624,7 +619,7 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
         private final ClusterNode node;
 
         /** Rows. */
-        private List<Object> rows = new ArrayList<>();
+        private final List<Object> rows = new ArrayList<>();
 
         /** Local backup rows. */
         private List<Object> locBkpRows;
@@ -650,12 +645,12 @@ public class GridNearTxEnlistFuture extends 
GridNearTxAbstractEnlistFuture<GridC
          * Adds a row.
          *
          * @param row Row.
-         * @param localBackup {@code true}, when the row key has local backup.
+         * @param locBackup {@code true}, when the row key has local backup.
          */
-        public void add(Object row, boolean localBackup) {
+        public void add(Object row, boolean locBackup) {
             rows.add(row);
 
-            if (localBackup) {
+            if (locBackup) {
                 if (locBkpRows == null)
                     locBkpRows = new ArrayList<>();
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryAbstractEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryAbstractEnlistFuture.java
index 714c62d41e6..6bce203d606 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryAbstractEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryAbstractEnlistFuture.java
@@ -29,7 +29,7 @@ public abstract class GridNearTxQueryAbstractEnlistFuture 
extends GridNearTxAbst
      * @param tx Transaction.
      * @param timeout Timeout.
      */
-    public GridNearTxQueryAbstractEnlistFuture(
+    protected GridNearTxQueryAbstractEnlistFuture(
         GridCacheContext<?, ?> cctx, GridNearTxLocal tx, long timeout) {
         super(cctx, tx, timeout, CU.longReducer());
     }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryEnlistFuture.java
index 1ed6abbd3ce..f9c021db5b7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryEnlistFuture.java
@@ -32,10 +32,10 @@ import 
org.apache.ignite.internal.processors.affinity.AffinityAssignment;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import 
org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping;
+import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxAbstractEnlistFuture;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxQueryEnlistFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.CI1;
 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;
@@ -135,11 +135,11 @@ public class GridNearTxQueryEnlistFuture extends 
GridNearTxQueryAbstractEnlistFu
 
             if (map.isEmpty())
                 throw new ClusterTopologyServerNotFoundException("Failed to 
find data nodes for cache (all partition " +
-                    "nodes left the grid). [fut=" + toString() + ']');
+                    "nodes left the grid). [fut=" + this + ']');
 
             int idx = 0; boolean first = true, clientFirst = false;
 
-            GridDhtTxQueryEnlistFuture localFut = null;
+            GridDhtTxQueryEnlistFuture locFut = null;
 
             for (Map.Entry<ClusterNode, IntArrayHolder> entry : 
map.entrySet()) {
                 MiniFuture mini; ClusterNode node = entry.getKey(); 
IntArrayHolder parts = entry.getValue();
@@ -147,7 +147,7 @@ public class GridNearTxQueryEnlistFuture extends 
GridNearTxQueryAbstractEnlistFu
                 add(mini = new MiniFuture(node));
 
                 if (node.isLocal()) {
-                    localFut = new GridDhtTxQueryEnlistFuture(
+                    locFut = new GridDhtTxQueryEnlistFuture(
                         cctx.localNode().id(),
                         lockVer,
                         mvccSnapshot,
@@ -165,25 +165,23 @@ public class GridNearTxQueryEnlistFuture extends 
GridNearTxQueryAbstractEnlistFu
                         remainingTime(),
                         cctx);
 
-                    updateLocalFuture(localFut);
+                    updateLocalFuture(locFut);
 
-                    localFut.listen(new CI1<IgniteInternalFuture<Long>>() {
-                        @Override public void apply(IgniteInternalFuture<Long> 
fut) {
-                            assert fut.error() != null || fut.result() != null 
: fut;
+                    locFut.listen((IgniteInternalFuture<Long> fut) -> {
+                        assert fut.error() != null || fut.result() != null : 
fut;
 
-                            try {
-                                
clearLocalFuture((GridDhtTxQueryEnlistFuture)fut);
+                        try {
+                            
clearLocalFuture((GridDhtTxAbstractEnlistFuture)fut);
 
-                                GridNearTxQueryEnlistResponse res = 
fut.error() == null ? createResponse(fut) : null;
+                            GridNearTxQueryEnlistResponse res = fut.error() == 
null ? createResponse(fut) : null;
 
-                                mini.onResult(res, fut.error());
-                            }
-                            catch (IgniteCheckedException e) {
-                                mini.onResult(null, e);
-                            }
-                            finally {
-                                CU.unwindEvicts(cctx);
-                            }
+                            mini.onResult(res, fut.error());
+                        }
+                        catch (IgniteCheckedException e) {
+                            mini.onResult(null, e);
+                        }
+                        finally {
+                            CU.unwindEvicts(cctx);
                         }
                     });
                 }
@@ -221,8 +219,8 @@ public class GridNearTxQueryEnlistFuture extends 
GridNearTxQueryAbstractEnlistFu
 
             markInitialized();
 
-            if (localFut != null)
-                localFut.init();
+            if (locFut != null)
+                locFut.init();
         }
         catch (Throwable e) {
             onDone(e);
@@ -301,10 +299,9 @@ public class GridNearTxQueryEnlistFuture extends 
GridNearTxQueryAbstractEnlistFu
     }
 
     /**
-     * @param nodeId Sender node id.
      * @param res Response.
      */
-    public void onResult(UUID nodeId, GridNearTxQueryEnlistResponse res) {
+    public void onResult(GridNearTxQueryEnlistResponse res) {
         MiniFuture mini = miniFuture(res.miniId());
 
         if (mini != null)
@@ -387,30 +384,30 @@ public class GridNearTxQueryEnlistFuture extends 
GridNearTxQueryAbstractEnlistFu
     /** */
     private static class IntArrayHolder {
         /** */
-        private int[] array;
+        private int[] arr;
 
         /** */
         private int size;
 
         /** */
         void add(int i) {
-            if (array == null)
-                array = new int[4];
+            if (arr == null)
+                arr = new int[4];
 
-            if (array.length == size)
-                array = Arrays.copyOf(array, size << 1);
+            if (arr.length == size)
+                arr = Arrays.copyOf(arr, size << 1);
 
-            array[size++] = i;
+            arr[size++] = i;
         }
 
         /** */
         public int[] array() {
-            if (array == null)
+            if (arr == null)
                 return null;
-            else if (size == array.length)
-                return array;
+            else if (size == arr.length)
+                return arr;
             else
-                return Arrays.copyOf(array, size);
+                return Arrays.copyOf(arr, size);
         }
     }
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryResultsEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryResultsEnlistFuture.java
index 959f7468612..6a8b722d1cf 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryResultsEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxQueryResultsEnlistFuture.java
@@ -37,7 +37,6 @@ import 
org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 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.GridDhtTxAbstractEnlistFuture;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxQueryResultsEnlistFuture;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshotWithoutTxs;
@@ -47,11 +46,9 @@ import 
org.apache.ignite.internal.processors.query.UpdateSourceIterator;
 import org.apache.ignite.internal.processors.security.SecurityUtils;
 import 
org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.CI1;
 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.S;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.jetbrains.annotations.Nullable;
@@ -84,10 +81,10 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
     private final UpdateSourceIterator<?> it;
 
     /** */
-    private int batchSize;
+    private final int batchSize;
 
     /** */
-    private AtomicInteger batchCntr = new AtomicInteger();
+    private final AtomicInteger batchCntr = new AtomicInteger();
 
     /** */
     @SuppressWarnings("unused")
@@ -198,7 +195,7 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
 
                 Object cur = next0();
 
-                KeyCacheObject key = cctx.toCacheKeyObject(op.isDeleteOrLock() 
? cur : ((IgniteBiTuple)cur).getKey());
+                KeyCacheObject key = cctx.toCacheKeyObject(op.isDeleteOrLock() 
? cur : ((Map.Entry<?, ?>)cur).getKey());
 
                 ClusterNode node = 
cctx.affinity().primaryByPartition(key.partition(), topVer);
 
@@ -331,8 +328,8 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
             if (keysOnly)
                 keys.add(cctx.toCacheKeyObject(row));
             else {
-                keys.add(cctx.toCacheKeyObject(((IgniteBiTuple)row).getKey()));
-                vals.add(cctx.toCacheObject(((IgniteBiTuple)row).getValue()));
+                keys.add(cctx.toCacheKeyObject(((Map.Entry<?, 
?>)row).getKey()));
+                vals.add(cctx.toCacheObject(((Map.Entry<?, 
?>)row).getValue()));
             }
         }
 
@@ -463,24 +460,22 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
 
         updateLocalFuture(fut);
 
-        fut.listen(new CI1<IgniteInternalFuture<Long>>() {
-            @Override public void apply(IgniteInternalFuture<Long> fut) {
-                assert fut.error() != null || fut.result() != null : fut;
+        fut.listen((IgniteInternalFuture<Long> fut0) -> {
+            assert fut.error() != null || fut.result() != null : fut;
 
-                try {
-                    clearLocalFuture((GridDhtTxAbstractEnlistFuture)fut);
+            try {
+                clearLocalFuture(fut);
 
-                    GridNearTxQueryResultsEnlistResponse res = fut.error() == 
null ? createResponse(fut) : null;
+                GridNearTxQueryResultsEnlistResponse res = fut.error() == null 
? createResponse(fut) : null;
 
-                    if (checkResponse(nodeId, res, fut.error()))
-                        sendNextBatches(nodeId);
-                }
-                catch (IgniteCheckedException e) {
-                    checkResponse(nodeId, null, e);
-                }
-                finally {
-                    CU.unwindEvicts(cctx);
-                }
+                if (checkResponse(nodeId, res, fut.error()))
+                    sendNextBatches(nodeId);
+            }
+            catch (IgniteCheckedException e) {
+                checkResponse(nodeId, null, e);
+            }
+            finally {
+                CU.unwindEvicts(cctx);
             }
         });
 
@@ -505,7 +500,7 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
 
     /** {@inheritDoc} */
     @Override public boolean onNodeLeft(UUID nodeId) {
-        if (batches.keySet().contains(nodeId)) {
+        if (batches.containsKey(nodeId)) {
             if (log.isDebugEnabled())
                 log.debug("Found unacknowledged batch for left node [nodeId=" 
+ nodeId + ", fut=" +
                     this + ']');
@@ -571,13 +566,13 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
     /**
      * A batch of rows
      */
-    private class Batch {
+    private static class Batch {
         /** Node ID. */
         @GridToStringExclude
         private final ClusterNode node;
 
         /** Rows. */
-        private ArrayList<Object> rows = new ArrayList<>();
+        private final ArrayList<Object> rows = new ArrayList<>();
 
         /** Local backup rows. */
         private ArrayList<Object> locBkpRows;
@@ -603,12 +598,12 @@ public class GridNearTxQueryResultsEnlistFuture extends 
GridNearTxQueryAbstractE
          * Adds a row.
          *
          * @param row Row.
-         * @param localBackup {@code true}, when the row key has local backup.
+         * @param locBackup {@code true}, when the row key has local backup.
          */
-        public void add(Object row, boolean localBackup) {
+        public void add(Object row, boolean locBackup) {
             rows.add(row);
 
-            if (localBackup) {
+            if (locBackup) {
                 if (locBkpRows == null)
                     locBkpRows = new ArrayList<>();
 

Reply via email to