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 55963425e1b IGNITE-20085 GridNearTxRemote initial cleanup (#10861)
55963425e1b is described below

commit 55963425e1bfcf6fb85ea3c42c9704f22fb50a30
Author: Anton Vinogradov <a...@apache.org>
AuthorDate: Tue Aug 1 13:47:10 2023 +0300

    IGNITE-20085 GridNearTxRemote initial cleanup (#10861)
---
 .../cache/distributed/near/GridNearTxRemote.java   | 39 +++++-----------------
 1 file changed, 9 insertions(+), 30 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
index 028d1358945..921c789d718 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
@@ -48,10 +48,10 @@ import org.jetbrains.annotations.Nullable;
  */
 public class GridNearTxRemote extends GridDistributedTxRemoteAdapter {
     /** Evicted keys. */
-    private Collection<IgniteTxKey> evicted = new LinkedList<>();
+    private final Collection<IgniteTxKey> evicted = new LinkedList<>();
 
     /** Near node ID. */
-    private UUID nearNodeId;
+    private final UUID nearNodeId;
 
     /** Near transaction ID. */
     private GridCacheVersion nearXidVer;
@@ -125,8 +125,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
 
         int writeSize = writeEntries != null ? Math.max(txSize, 
writeEntries.size()) : txSize;
 
-        txState = new IgniteTxRemoteStateImpl(Collections.<IgniteTxKey, 
IgniteTxEntry>emptyMap(),
-            U.<IgniteTxKey, IgniteTxEntry>newLinkedHashMap(writeSize));
+        txState = new IgniteTxRemoteStateImpl(Collections.emptyMap(), 
U.newLinkedHashMap(writeSize));
 
         if (writeEntries != null) {
             for (IgniteTxEntry entry : writeEntries) {
@@ -203,8 +202,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
         this.nearXidVer = nearXidVer;
         this.nearNodeId = nearNodeId;
 
-        txState = new IgniteTxRemoteStateImpl(U.<IgniteTxKey, 
IgniteTxEntry>newLinkedHashMap(1),
-            U.<IgniteTxKey, IgniteTxEntry>newLinkedHashMap(txSize));
+        txState = new IgniteTxRemoteStateImpl(U.newLinkedHashMap(1), 
U.newLinkedHashMap(txSize));
 
         assert topVer != null && topVer.topologyVersion() > 0 : topVer;
 
@@ -239,7 +237,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public void addActiveCache(GridCacheContext cacheCtx, boolean 
recovery) throws IgniteCheckedException {
+    @Override public void addActiveCache(GridCacheContext cacheCtx, boolean 
recovery) {
         throw new UnsupportedOperationException("Near tx doesn't track active 
caches.");
     }
 
@@ -258,13 +256,6 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
         owned.putAll(vers);
     }
 
-    /**
-     * @return Near node ID.
-     */
-    public UUID nearNodeId() {
-        return nearNodeId;
-    }
-
     /** {@inheritDoc} */
     @Override public Collection<UUID> masterNodeIds() {
         Collection<UUID> res = new ArrayList<>(2);
@@ -309,33 +300,25 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
     /**
      * @param entry Entry to enlist.
      * @throws IgniteCheckedException If failed.
-     * @return {@code True} if entry was enlisted.
      */
-    private boolean addEntry(IgniteTxEntry entry) throws 
IgniteCheckedException {
+    private void addEntry(IgniteTxEntry entry) throws IgniteCheckedException {
         checkInternal(entry.txKey());
 
-        GridCacheContext cacheCtx = entry.context();
+        GridCacheContext<?, ?> cacheCtx = entry.context();
 
         assert cacheCtx.isNear() : entry;
 
         GridNearCacheEntry cached = cacheCtx.near().peekExx(entry.key());
 
-        if (cached == null) {
+        if (cached == null)
             evicted.add(entry.txKey());
-
-            return false;
-        }
         else {
             try {
                 // Unswap is no-op for near cache.
-
                 CacheObject val = cached.peek();
 
-                if (val == null && cached.evictInternal(xidVer, null, false)) {
+                if (val == null && cached.evictInternal(xidVer, null, false))
                     evicted.add(entry.txKey());
-
-                    return false;
-                }
                 else {
                     // Initialize cache entry.
                     entry.cached(cached);
@@ -343,8 +326,6 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
                     txState.addWriteEntry(entry.txKey(), entry);
 
                     addExplicit(entry);
-
-                    return true;
                 }
             }
             catch (GridCacheEntryRemovedException ignore) {
@@ -352,8 +333,6 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
 
                 if (log.isDebugEnabled())
                     log.debug("Got removed entry when adding to remote 
transaction (will ignore): " + cached);
-
-                return false;
             }
         }
     }

Reply via email to