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 3b8e51345f7 IGNITE-22790 Initial cleanup of Grid*Request and 
Grid*Response classes (#11461)
3b8e51345f7 is described below

commit 3b8e51345f76d3002e1c563d9ad32a8a95ea710d
Author: Ilya Shishkov <[email protected]>
AuthorDate: Tue Aug 6 18:24:58 2024 +0300

    IGNITE-22790 Initial cleanup of Grid*Request and Grid*Response classes 
(#11461)
---
 .../processors/cache/GridCacheMessage.java         |   6 +-
 .../internal/processors/cache/GridCacheUtils.java  |  14 +--
 .../distributed/GridCacheTxRecoveryRequest.java    |   2 +-
 .../distributed/GridCacheTxRecoveryResponse.java   |   2 +-
 .../distributed/GridDistributedLockRequest.java    |  20 ++--
 .../distributed/GridDistributedLockResponse.java   |   6 +-
 .../GridDistributedTxFinishRequest.java            |   2 +-
 .../GridDistributedTxFinishResponse.java           |   2 +-
 .../distributed/GridDistributedTxMapping.java      |  12 +--
 .../GridDistributedTxPrepareRequest.java           |  27 ++---
 .../GridDistributedTxPrepareResponse.java          |   6 +-
 .../GridDistributedTxRemoteAdapter.java            |   2 +-
 .../distributed/GridDistributedUnlockRequest.java  |  11 +-
 .../cache/distributed/dht/GridDhtLockFuture.java   |   2 +-
 .../cache/distributed/dht/GridDhtLockRequest.java  |  24 ++---
 .../cache/distributed/dht/GridDhtLockResponse.java |  17 ++-
 .../dht/GridDhtTransactionalCacheAdapter.java      |  20 ++--
 .../distributed/dht/GridDhtTxFinishResponse.java   |   8 +-
 .../cache/distributed/dht/GridDhtTxMapping.java    |   2 +-
 .../distributed/dht/GridDhtTxPrepareRequest.java   |   8 +-
 .../distributed/dht/GridDhtTxPrepareResponse.java  |  16 +--
 .../distributed/dht/GridDhtUnlockRequest.java      |   4 +-
 .../dht/colocated/GridDhtColocatedCache.java       | 119 ++++++++++-----------
 .../dht/colocated/GridDhtColocatedLockFuture.java  |   5 +-
 .../cache/distributed/near/GridNearGetRequest.java |   8 +-
 .../distributed/near/GridNearGetResponse.java      |  10 +-
 .../cache/distributed/near/GridNearLockFuture.java |   7 +-
 .../distributed/near/GridNearLockRequest.java      |  24 ++---
 .../distributed/near/GridNearSingleGetRequest.java |   8 +-
 .../near/GridNearSingleGetResponse.java            |  12 +--
 .../near/GridNearTransactionalCache.java           |  14 +--
 .../distributed/near/GridNearTxFinishResponse.java |   7 +-
 .../distributed/near/GridNearTxPrepareRequest.java |   2 +-
 .../near/GridNearTxPrepareResponse.java            |  22 ++--
 .../cache/distributed/near/GridNearTxRemote.java   |   8 +-
 .../cache/transactions/IgniteTxAdapter.java        |   2 +-
 .../cache/transactions/IgniteTxLocalAdapter.java   |   2 +-
 .../cache/transactions/TxLocksRequest.java         |   9 +-
 .../cache/transactions/TxLocksResponse.java        |  11 +-
 39 files changed, 206 insertions(+), 277 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index c655dc487ef..c4fc5981322 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -286,7 +286,7 @@ public abstract class GridCacheMessage implements Message {
      * @param ctx Cache context.
      * @throws IgniteCheckedException If failed.
      */
-    public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws 
IgniteCheckedException {
         // No-op.
     }
 
@@ -298,7 +298,7 @@ public abstract class GridCacheMessage implements Message {
      * @param ldr Class loader.
      * @throws IgniteCheckedException If failed.
      */
-    public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) 
throws IgniteCheckedException {
+    public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader 
ldr) throws IgniteCheckedException {
         // No-op.
     }
 
@@ -657,7 +657,7 @@ public abstract class GridCacheMessage implements Message {
      * @param ctx Context.
      * @return Logger.
      */
-    public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> ctx) {
         return ctx.messageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index c0a5a176865..805e88f716e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -256,7 +256,7 @@ public class GridCacheUtils {
     private static final CacheEntryPredicate[] ALWAYS_FALSE0_ARR = new 
CacheEntryPredicate[] {ALWAYS_FALSE0};
 
     /** Read filter. */
-    public static final IgnitePredicate READ_FILTER = new P1<IgniteTxEntry>() {
+    public static final IgnitePredicate<IgniteTxEntry> READ_FILTER = new 
P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.op() == READ;
         }
@@ -267,7 +267,7 @@ public class GridCacheUtils {
     };
 
     /** Read filter. */
-    public static final IgnitePredicate READ_FILTER_NEAR = new 
P1<IgniteTxEntry>() {
+    public static final IgnitePredicate<IgniteTxEntry> READ_FILTER_NEAR = new 
P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.op() == READ && e.context().isNear();
         }
@@ -278,7 +278,7 @@ public class GridCacheUtils {
     };
 
     /** Read filter. */
-    public static final IgnitePredicate READ_FILTER_COLOCATED = new 
P1<IgniteTxEntry>() {
+    public static final IgnitePredicate<IgniteTxEntry> READ_FILTER_COLOCATED = 
new P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.op() == READ && !e.context().isNear();
         }
@@ -289,7 +289,7 @@ public class GridCacheUtils {
     };
 
     /** Write filter. */
-    public static final IgnitePredicate WRITE_FILTER = new P1<IgniteTxEntry>() 
{
+    public static final IgnitePredicate<IgniteTxEntry> WRITE_FILTER = new 
P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.op() != READ;
         }
@@ -300,7 +300,7 @@ public class GridCacheUtils {
     };
 
     /** Write filter. */
-    public static final IgnitePredicate WRITE_FILTER_NEAR = new 
P1<IgniteTxEntry>() {
+    public static final IgnitePredicate<IgniteTxEntry> WRITE_FILTER_NEAR = new 
P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.op() != READ && e.context().isNear();
         }
@@ -311,7 +311,7 @@ public class GridCacheUtils {
     };
 
     /** Write filter. */
-    public static final IgnitePredicate WRITE_FILTER_COLOCATED = new 
P1<IgniteTxEntry>() {
+    public static final IgnitePredicate<IgniteTxEntry> WRITE_FILTER_COLOCATED 
= new P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.op() != READ && !e.context().isNear();
         }
@@ -322,7 +322,7 @@ public class GridCacheUtils {
     };
 
     /** Write filter. */
-    public static final IgnitePredicate FILTER_NEAR_CACHE_ENTRY = new 
P1<IgniteTxEntry>() {
+    public static final IgnitePredicate<IgniteTxEntry> FILTER_NEAR_CACHE_ENTRY 
= new P1<IgniteTxEntry>() {
         @Override public boolean apply(IgniteTxEntry e) {
             return e.context().isNear();
         }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
index 7587422e7a6..a314985c775 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
@@ -129,7 +129,7 @@ public class GridCacheTxRecoveryRequest extends 
GridDistributedBaseMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txRecoveryMessageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
index 1ef44a8f21f..90715f4a59a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
@@ -110,7 +110,7 @@ public class GridCacheTxRecoveryResponse extends 
GridDistributedBaseMessage impl
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txRecoveryMessageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
index ca78763fc21..ecc23a82d0f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
@@ -266,7 +266,7 @@ public class GridDistributedLockRequest extends 
GridDistributedBaseMessage {
      */
     public void storeUsed(boolean storeUsed) {
         if (storeUsed)
-            flags = (byte)(flags | STORE_USED_FLAG_MASK);
+            flags |= STORE_USED_FLAG_MASK;
         else
             flags &= ~STORE_USED_FLAG_MASK;
     }
@@ -290,14 +290,8 @@ public class GridDistributedLockRequest extends 
GridDistributedBaseMessage {
      *
      * @param key Key.
      * @param retVal Flag indicating whether value should be returned.
-     * @param ctx Context.
-     * @throws IgniteCheckedException If failed.
      */
-    public void addKeyBytes(
-        KeyCacheObject key,
-        boolean retVal,
-        GridCacheContext ctx
-    ) throws IgniteCheckedException {
+    public void addKeyBytes(KeyCacheObject key, boolean retVal) {
         if (keys == null)
             keys = new ArrayList<>(keysCount());
 
@@ -328,25 +322,25 @@ public class GridDistributedLockRequest extends 
GridDistributedBaseMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txLockMessageLogger();
     }
 
     /** {@inheritDoc}
      * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         prepareMarshalCacheObjects(keys, cctx);
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         finishUnmarshalCacheObjects(keys, cctx, ldr);
     }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index 2d4de9c8156..b513b96de88 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -181,13 +181,13 @@ public class GridDistributedLockResponse extends 
GridDistributedBaseMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txLockMessageLogger();
     }
 
     /** {@inheritDoc}
      * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         prepareMarshalCacheObjects(vals, ctx.cacheContext(cacheId));
@@ -197,7 +197,7 @@ public class GridDistributedLockResponse extends 
GridDistributedBaseMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         finishUnmarshalCacheObjects(vals, ctx.cacheContext(cacheId), ldr);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index 9a8824ff168..f101c2bdcec 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@ -293,7 +293,7 @@ public class GridDistributedTxFinishRequest extends 
GridDistributedBaseMessage i
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txFinishMessageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
index 5fdf970bc0f..38d503f5b86 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
@@ -126,7 +126,7 @@ public class GridDistributedTxFinishResponse extends 
GridCacheMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txFinishMessageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
index a5f780743ac..c5b3c298cc6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
@@ -234,7 +233,7 @@ public class GridDistributedTxMapping {
      * @param keys Keys to evict readers for.
      */
     public void evictReaders(@Nullable Collection<IgniteTxKey> keys) {
-        if (keys == null || keys.isEmpty())
+        if (F.isEmpty(keys))
             return;
 
         evictReaders(keys, entries);
@@ -245,15 +244,10 @@ public class GridDistributedTxMapping {
      * @param entries Entries to check.
      */
     private void evictReaders(Collection<IgniteTxKey> keys, @Nullable 
Collection<IgniteTxEntry> entries) {
-        if (entries == null || entries.isEmpty())
+        if (F.isEmpty(entries))
             return;
 
-        for (Iterator<IgniteTxEntry> it = entries.iterator(); it.hasNext();) {
-            IgniteTxEntry entry = it.next();
-
-            if (keys.contains(entry.txKey()))
-                it.remove();
-        }
+        entries.removeIf(entry -> keys.contains(entry.txKey()));
     }
 
     /**
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 2d6da9c33d9..5e2d7e1194e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -79,18 +79,10 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
     public static final int STORE_WRITE_THROUGH_FLAG_MASK = 0x20;
 
     /** Collection to message converter. */
-    private static final C1<Collection<UUID>, UUIDCollectionMessage> 
COL_TO_MSG = new C1<Collection<UUID>, UUIDCollectionMessage>() {
-        @Override public UUIDCollectionMessage apply(Collection<UUID> uuids) {
-            return new UUIDCollectionMessage(uuids);
-        }
-    };
+    private static final C1<Collection<UUID>, UUIDCollectionMessage> 
COL_TO_MSG = UUIDCollectionMessage::new;
 
     /** Message to collection converter. */
-    private static final C1<UUIDCollectionMessage, Collection<UUID>> 
MSG_TO_COL = new C1<UUIDCollectionMessage, Collection<UUID>>() {
-        @Override public Collection<UUID> apply(UUIDCollectionMessage msg) {
-            return msg.uuids();
-        }
-    };
+    private static final C1<UUIDCollectionMessage, Collection<UUID>> 
MSG_TO_COL = UUIDCollectionMessage::uuids;
 
     /** Thread ID. */
     @GridToStringInclude
@@ -247,7 +239,7 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
      */
     public void storeWriteThrough(boolean storeWriteThrough) {
         if (storeWriteThrough)
-            flags = (byte)(flags | STORE_WRITE_THROUGH_FLAG_MASK);
+            flags |= STORE_WRITE_THROUGH_FLAG_MASK;
         else
             flags &= ~STORE_WRITE_THROUGH_FLAG_MASK;
     }
@@ -276,7 +268,7 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
      * @return Map of versions to be verified.
      */
     public Map<IgniteTxKey, GridCacheVersion> dhtVersions() {
-        return dhtVers == null ? Collections.<IgniteTxKey, 
GridCacheVersion>emptyMap() : dhtVers;
+        return dhtVers == null ? Collections.emptyMap() : dhtVers;
     }
 
     /**
@@ -380,9 +372,8 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
         this.txState = txState;
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (writes != null)
@@ -393,7 +384,7 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
 
         if (dhtVers != null && dhtVerKeys == null) {
             for (IgniteTxKey key : dhtVers.keySet()) {
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 key.prepareMarshal(cctx);
             }
@@ -407,7 +398,7 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (writes != null)
@@ -444,7 +435,7 @@ public class GridDistributedTxPrepareRequest extends 
GridDistributedBaseMessage
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txPrepareMessageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index c26880e10fe..55a5ab74e46 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@ -143,12 +143,12 @@ public class GridDistributedTxPrepareResponse extends 
GridDistributedBaseMessage
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txPrepareMessageLogger();
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (err != null && errBytes == null)
@@ -156,7 +156,7 @@ public class GridDistributedTxPrepareResponse extends 
GridDistributedBaseMessage
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (errBytes != null && err == null)
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index 5754a89d978..0be4dca2f63 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -205,7 +205,7 @@ public abstract class GridDistributedTxRemoteAdapter 
extends IgniteTxAdapter imp
     }
 
     /** {@inheritDoc} */
-    @Override public void addActiveCache(GridCacheContext cacheCtx, boolean 
recovery) throws IgniteCheckedException {
+    @Override public void addActiveCache(GridCacheContext<?, ?> cacheCtx, 
boolean recovery) throws IgniteCheckedException {
         txState.addActiveCache(cacheCtx, recovery, this);
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
index 001eb615895..c0dc4bbc66d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
@@ -24,7 +24,6 @@ import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -72,10 +71,8 @@ public class GridDistributedUnlockRequest extends 
GridDistributedBaseMessage {
 
     /**
      * @param key Key.
-     * @param ctx Context.
-     * @throws IgniteCheckedException If failed.
      */
-    public void addKey(KeyCacheObject key, GridCacheContext ctx) throws 
IgniteCheckedException {
+    public void addKey(KeyCacheObject key) {
         if (keys == null)
             keys = new ArrayList<>(keysCount());
 
@@ -89,21 +86,21 @@ public class GridDistributedUnlockRequest extends 
GridDistributedBaseMessage {
 
     /** {@inheritDoc}
      * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         prepareMarshalCacheObjects(keys, ctx.cacheContext(cacheId));
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         finishUnmarshalCacheObjects(keys, ctx.cacheContext(cacheId), ldr);
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+    @Override public IgniteLogger messageLogger(GridCacheSharedContext<?, ?> 
ctx) {
         return ctx.txLockMessageLogger();
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index f5ed1f1e577..f7c87300c76 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -948,7 +948,7 @@ public final class GridDhtLockFuture extends 
GridCacheCompoundIdentityFuture<Boo
 
                                     boolean invalidateRdr = e.readerId(n.id()) 
!= null;
 
-                                    req.addDhtKey(e.key(), invalidateRdr, 
cctx);
+                                    req.addDhtKey(e.key(), invalidateRdr);
 
                                     if (needVal) {
                                         // Mark last added key as needed to be 
preloaded.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
index 9f4bddd5881..9978813406e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
@@ -29,7 +29,6 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import 
org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest;
@@ -170,7 +169,7 @@ public class GridDhtLockRequest extends 
GridDistributedLockRequest {
 
         storeUsed(storeUsed);
 
-        nearKeys = nearCnt == 0 ? Collections.<KeyCacheObject>emptyList() : 
new ArrayList<KeyCacheObject>(nearCnt);
+        nearKeys = nearCnt == 0 ? Collections.emptyList() : new 
ArrayList<>(nearCnt);
         invalidateEntries = new BitSet(dhtCnt == 0 ? nearCnt : dhtCnt);
 
         assert miniId != null;
@@ -207,11 +206,8 @@ public class GridDhtLockRequest extends 
GridDistributedLockRequest {
      * Adds a Near key.
      *
      * @param key Key.
-     * @param ctx Context.
-     * @throws IgniteCheckedException If failed.
      */
-    public void addNearKey(KeyCacheObject key, GridCacheSharedContext ctx)
-        throws IgniteCheckedException {
+    public void addNearKey(KeyCacheObject key) {
         nearKeys.add(key);
     }
 
@@ -219,7 +215,7 @@ public class GridDhtLockRequest extends 
GridDistributedLockRequest {
      * @return Near keys.
      */
     public List<KeyCacheObject> nearKeys() {
-        return nearKeys == null ? Collections.<KeyCacheObject>emptyList() : 
nearKeys;
+        return nearKeys == null ? Collections.emptyList() : nearKeys;
     }
 
     /**
@@ -227,17 +223,11 @@ public class GridDhtLockRequest extends 
GridDistributedLockRequest {
      *
      * @param key Key.
      * @param invalidateEntry Flag indicating whether node should attempt to 
invalidate reader.
-     * @param ctx Context.
-     * @throws IgniteCheckedException If failed.
      */
-    public void addDhtKey(
-        KeyCacheObject key,
-        boolean invalidateEntry,
-        GridCacheContext ctx
-    ) throws IgniteCheckedException {
+    public void addDhtKey(KeyCacheObject key, boolean invalidateEntry) {
         invalidateEntries.set(idx, invalidateEntry);
 
-        addKeyBytes(key, false, ctx);
+        addKeyBytes(key, false);
     }
 
     /**
@@ -311,7 +301,7 @@ public class GridDhtLockRequest extends 
GridDistributedLockRequest {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         prepareMarshalCacheObjects(nearKeys, ctx.cacheContext(cacheId));
@@ -331,7 +321,7 @@ public class GridDhtLockRequest extends 
GridDistributedLockRequest {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         finishUnmarshalCacheObjects(nearKeys, ctx.cacheContext(cacheId), ldr);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
index 63c07e82906..eef2f27f860 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
@@ -91,7 +91,7 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
      * @param futId Future ID.
      * @param miniId Mini future ID.
      * @param err Error.
-     * @param addDepInfo
+     * @param addDepInfo Deployment info.
      */
     public GridDhtLockResponse(int cacheId, GridCacheVersion lockVer, 
IgniteUuid futId, IgniteUuid miniId,
         Throwable err, boolean addDepInfo) {
@@ -137,7 +137,7 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
      * @return Invalid partitions.
      */
     public Collection<Integer> invalidPartitions() {
-        return invalidParts == null ? Collections.<Integer>emptySet() : 
invalidParts;
+        return invalidParts == null ? Collections.emptySet() : invalidParts;
     }
 
     /**
@@ -158,15 +158,14 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
      * @return Collection of preload entries.
      */
     public Collection<GridCacheEntryInfo> preloadEntries() {
-        return preloadEntries == null ? 
Collections.<GridCacheEntryInfo>emptyList() : preloadEntries;
+        return preloadEntries == null ? Collections.emptyList() : 
preloadEntries;
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         if (nearEvicted != null) {
             for (IgniteTxKey key : nearEvicted)
@@ -178,10 +177,10 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         if (nearEvicted != null) {
             for (IgniteTxKey key : nearEvicted)
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 9bca9f187a7..cbf3c3b287c 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
@@ -95,7 +95,6 @@ import static 
org.apache.ignite.transactions.TransactionState.COMMITTING;
 /**
  * Base class for transactional DHT caches.
  */
-@SuppressWarnings("unchecked")
 public abstract class GridDhtTransactionalCacheAdapter<K, V> extends 
GridDhtCacheAdapter<K, V> {
     /** */
     private static final long serialVersionUID = 0L;
@@ -528,7 +527,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
 
         if (res != null) {
             try {
-                // Reply back to sender.
+                // Reply to sender.
                 ctx.io().send(nodeId, res, ctx.ioPolicy());
 
                 if (txLockMsgLog.isDebugEnabled()) {
@@ -638,27 +637,26 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
     }
 
     /**
-     * @param nearNode
-     * @param req
+     * @param nearNode Near node.
+     * @param req Near lock request.
      */
     private void processNearLockRequest0(ClusterNode nearNode, 
GridNearLockRequest req) {
         IgniteInternalFuture<?> f;
 
         if (req.firstClientRequest()) {
-            for (; ; ) {
+            do {
                 if (waitForExchangeFuture(nearNode, req))
                     return;
 
                 f = lockAllAsync(ctx, nearNode, req);
 
-                if (f != null)
-                    break;
             }
+            while (f == null);
         }
         else
             f = lockAllAsync(ctx, nearNode, req);
 
-        // Register listener just so we print out errors.
+        // Register listener just so we print errors.
         // Exclude lock timeout and rollback exceptions since it's not a fatal 
exception.
         f.listen(CU.errorLogger(log, GridCacheLockTimeoutException.class,
             GridDistributedLockCancelledException.class, 
IgniteTxTimeoutCheckedException.class,
@@ -1075,7 +1073,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
 
                 final GridDhtTxLocal t = tx;
 
-                return new GridDhtEmbeddedFuture(
+                return new GridDhtEmbeddedFuture<>(
                     txFut,
                     new C2<GridCacheReturn, Exception, 
IgniteInternalFuture<GridNearLockResponse>>() {
                         @Override public 
IgniteInternalFuture<GridNearLockResponse> apply(
@@ -1419,7 +1417,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
     }
 
     /**
-     * Collects versions of pending candidates versions less then base.
+     * Collects versions of pending candidates versions less than base.
      *
      * @param entries Tx entries to process.
      * @param baseVer Base version.
@@ -1704,7 +1702,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
 
             try {
                 for (KeyCacheObject key : keyBytes)
-                    req.addKey(key, ctx);
+                    req.addKey(key);
 
                 keyBytes = nearMap.get(n);
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
index d777a2201a1..43e8b9ff8a1 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
@@ -112,14 +112,14 @@ public class GridDhtTxFinishResponse extends 
GridDistributedTxFinishResponse {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (checkCommittedErr != null && checkCommittedErrBytes == null)
             checkCommittedErrBytes = U.marshal(ctx, checkCommittedErr);
 
         if (retVal != null && retVal.cacheId() != 0) {
-            GridCacheContext cctx = ctx.cacheContext(retVal.cacheId());
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(retVal.cacheId());
 
             assert cctx != null : retVal.cacheId();
 
@@ -128,7 +128,7 @@ public class GridDhtTxFinishResponse extends 
GridDistributedTxFinishResponse {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr)
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr)
         throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
@@ -136,7 +136,7 @@ public class GridDhtTxFinishResponse extends 
GridDistributedTxFinishResponse {
             checkCommittedErr = U.unmarshal(ctx, checkCommittedErrBytes, 
U.resolveClassLoader(ldr, ctx.gridConfig()));
 
         if (retVal != null && retVal.cacheId() != 0) {
-            GridCacheContext cctx = ctx.cacheContext(retVal.cacheId());
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(retVal.cacheId());
 
             assert cctx != null : retVal.cacheId();
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
index 27c77437e70..f8fcde238b3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
@@ -59,7 +59,7 @@ public class GridDhtTxMapping {
                 backups.add(nodes.get(i).id());
         }
         else
-            txNodes.put(primary.id(), new GridLeanSet<UUID>());
+            txNodes.put(primary.id(), new GridLeanSet<>());
     }
 
     /**
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
index b5c94db7905..c2737020f12 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
@@ -223,7 +223,7 @@ public class GridDhtTxPrepareRequest extends 
GridDistributedTxPrepareRequest {
      * @return Near writes.
      */
     public Collection<IgniteTxEntry> nearWrites() {
-        return nearWrites == null ? Collections.<IgniteTxEntry>emptyList() : 
nearWrites;
+        return nearWrites == null ? Collections.emptyList() : nearWrites;
     }
 
     /**
@@ -324,7 +324,7 @@ public class GridDhtTxPrepareRequest extends 
GridDistributedTxPrepareRequest {
      *
      * @param ctx
      */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (owned != null && ownedKeys == null) {
@@ -333,7 +333,7 @@ public class GridDhtTxPrepareRequest extends 
GridDistributedTxPrepareRequest {
             ownedVals = owned.values();
 
             for (IgniteTxKey key: ownedKeys) {
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 key.prepareMarshal(cctx);
 
@@ -347,7 +347,7 @@ public class GridDhtTxPrepareRequest extends 
GridDistributedTxPrepareRequest {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (ownedKeys != null) {
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index fcb14a34c58..8bcee12a921 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@ -160,7 +160,7 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
      * @param invalidPartsByCacheId Map from cache ID to an array of invalid 
partitions.
      */
     public void invalidPartitionsByCacheId(Map<Integer, Set<Integer>> 
invalidPartsByCacheId) {
-        this.invalidParts = CU.convertInvalidPartitions(invalidPartsByCacheId);
+        invalidParts = CU.convertInvalidPartitions(invalidPartsByCacheId);
     }
 
     /**
@@ -169,7 +169,7 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
      * @return Collection of entry infos need to be preloaded.
      */
     Collection<GridCacheEntryInfo> preloadEntries() {
-        return preloadEntries == null ? 
Collections.<GridCacheEntryInfo>emptyList() : preloadEntries;
+        return preloadEntries == null ? Collections.emptyList() : 
preloadEntries;
     }
 
     /**
@@ -187,12 +187,12 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (nearEvicted != null) {
             for (IgniteTxKey key : nearEvicted) {
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 // Can be null if client near cache was removed, in this case 
assume do not need prepareMarshal.
                 if (cctx != null)
@@ -202,7 +202,7 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
 
         if (preloadEntries != null) {
             for (GridCacheEntryInfo info : preloadEntries) {
-                GridCacheContext cctx = ctx.cacheContext(info.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(info.cacheId());
 
                 info.marshal(cctx);
             }
@@ -210,12 +210,12 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (nearEvicted != null) {
             for (IgniteTxKey key : nearEvicted) {
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 key.finishUnmarshal(cctx, ldr);
             }
@@ -223,7 +223,7 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
 
         if (preloadEntries != null) {
             for (GridCacheEntryInfo info : preloadEntries) {
-                GridCacheContext cctx = ctx.cacheContext(info.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(info.cacheId());
 
                 info.unmarshal(cctx, ldr);
             }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
index 3bc4de01f6b..9dec4122bc6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
@@ -80,14 +80,14 @@ public class GridDhtUnlockRequest extends 
GridDistributedUnlockRequest {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         prepareMarshalCacheObjects(nearKeys, ctx.cacheContext(cacheId));
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         finishUnmarshalCacheObjects(nearKeys, ctx.cacheContext(cacheId), ldr);
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 6d548ab56d4..fd3dee277c6 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
@@ -743,7 +743,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
 
                             KeyCacheObject key0 = entry != null ? entry.key() 
: cacheKey;
 
-                            req.addKey(key0, ctx);
+                            req.addKey(key0);
                         }
                         else
                             locKeys.add(cacheKey);
@@ -803,97 +803,92 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
         if (keys.isEmpty())
             return;
 
-        try {
-            int keyCnt = -1;
+        int keyCnt = -1;
 
-            Map<ClusterNode, GridNearUnlockRequest> map = null;
+        Map<ClusterNode, GridNearUnlockRequest> map = null;
 
-            Collection<KeyCacheObject> locKeys = new LinkedList<>();
+        Collection<KeyCacheObject> locKeys = new LinkedList<>();
 
-            for (KeyCacheObject key : keys) {
-                IgniteTxKey txKey = ctx.txKey(key);
+        for (KeyCacheObject key : keys) {
+            IgniteTxKey txKey = ctx.txKey(key);
 
-                GridCacheMvccCandidate lock = 
ctx.mvcc().removeExplicitLock(threadId, txKey, ver);
+            GridCacheMvccCandidate lock = 
ctx.mvcc().removeExplicitLock(threadId, txKey, ver);
 
-                if (lock != null) {
-                    AffinityTopologyVersion topVer = lock.topologyVersion();
+            if (lock != null) {
+                AffinityTopologyVersion topVer = lock.topologyVersion();
 
-                    if (map == null) {
-                        Collection<ClusterNode> affNodes = 
CU.affinityNodes(ctx, topVer);
+                if (map == null) {
+                    Collection<ClusterNode> affNodes = CU.affinityNodes(ctx, 
topVer);
 
-                        keyCnt = (int)Math.ceil((double)keys.size() / 
affNodes.size());
+                    keyCnt = (int)Math.ceil((double)keys.size() / 
affNodes.size());
 
-                        map = U.newHashMap(affNodes.size());
-                    }
+                    map = U.newHashMap(affNodes.size());
+                }
 
-                    ClusterNode primary = ctx.affinity().primaryByKey(key, 
topVer);
+                ClusterNode primary = ctx.affinity().primaryByKey(key, topVer);
 
-                    if (primary == null) {
-                        if (log.isDebugEnabled())
-                            log.debug("Failed to remove locks (all partition 
nodes left the grid).");
+                if (primary == null) {
+                    if (log.isDebugEnabled())
+                        log.debug("Failed to remove locks (all partition nodes 
left the grid).");
 
-                        continue;
-                    }
+                    continue;
+                }
 
-                    if (!primary.isLocal()) {
-                        // Send request to remove from remote nodes.
-                        GridNearUnlockRequest req = map.get(primary);
+                if (!primary.isLocal()) {
+                    // Send request to remove from remote nodes.
+                    GridNearUnlockRequest req = map.get(primary);
 
-                        if (req == null) {
-                            map.put(primary, req = new 
GridNearUnlockRequest(ctx.cacheId(), keyCnt,
-                                ctx.deploymentEnabled()));
+                    if (req == null) {
+                        map.put(primary, req = new 
GridNearUnlockRequest(ctx.cacheId(), keyCnt,
+                            ctx.deploymentEnabled()));
 
-                            req.version(ver);
-                        }
+                        req.version(ver);
+                    }
 
-                        GridCacheEntryEx entry = peekEx(key);
+                    GridCacheEntryEx entry = peekEx(key);
 
-                        KeyCacheObject key0 = entry != null ? entry.key() : 
key;
+                    KeyCacheObject key0 = entry != null ? entry.key() : key;
 
-                        req.addKey(key0, ctx);
-                    }
-                    else
-                        locKeys.add(key);
+                    req.addKey(key0);
                 }
+                else
+                    locKeys.add(key);
             }
+        }
 
-            if (!locKeys.isEmpty())
-                removeLocks(ctx.localNodeId(), ver, locKeys, true);
+        if (!locKeys.isEmpty())
+            removeLocks(ctx.localNodeId(), ver, locKeys, true);
 
-            if (map == null || map.isEmpty())
-                return;
+        if (map == null || map.isEmpty())
+            return;
 
-            IgnitePair<Collection<GridCacheVersion>> versPair = 
ctx.tm().versions(ver);
+        IgnitePair<Collection<GridCacheVersion>> versPair = 
ctx.tm().versions(ver);
 
-            Collection<GridCacheVersion> committed = versPair.get1();
-            Collection<GridCacheVersion> rolledback = versPair.get2();
+        Collection<GridCacheVersion> committed = versPair.get1();
+        Collection<GridCacheVersion> rolledback = versPair.get2();
 
-            for (Map.Entry<ClusterNode, GridNearUnlockRequest> mapping : 
map.entrySet()) {
-                ClusterNode n = mapping.getKey();
+        for (Map.Entry<ClusterNode, GridNearUnlockRequest> mapping : 
map.entrySet()) {
+            ClusterNode n = mapping.getKey();
 
-                GridDistributedUnlockRequest req = mapping.getValue();
+            GridDistributedUnlockRequest req = mapping.getValue();
 
-                if (!F.isEmpty(req.keys())) {
-                    req.completedVersions(committed, rolledback);
+            if (!F.isEmpty(req.keys())) {
+                req.completedVersions(committed, rolledback);
 
-                    try {
-                        // We don't wait for reply to this message.
-                        ctx.io().send(n, req, ctx.ioPolicy());
-                    }
-                    catch (ClusterTopologyCheckedException e) {
-                        if (log.isDebugEnabled())
-                            log.debug("Failed to send unlock request (node has 
left the grid) [keys=" + req.keys() +
-                                ", n=" + n + ", e=" + e + ']');
-                    }
-                    catch (IgniteCheckedException e) {
-                        U.error(log, "Failed to send unlock request [keys=" + 
req.keys() + ", n=" + n + ']', e);
-                    }
+                try {
+                    // We don't wait for reply to this message.
+                    ctx.io().send(n, req, ctx.ioPolicy());
+                }
+                catch (ClusterTopologyCheckedException e) {
+                    if (log.isDebugEnabled())
+                        log.debug("Failed to send unlock request (node has 
left the grid) [keys=" + req.keys() +
+                            ", n=" + n + ", e=" + e + ']');
+                }
+                catch (IgniteCheckedException e) {
+                    U.error(log, "Failed to send unlock request [keys=" + 
req.keys() + ", n=" + n + ']', e);
                 }
             }
         }
-        catch (IgniteCheckedException ex) {
-            U.error(log, "Failed to unlock the lock for keys: " + keys, ex);
-        }
     }
 
     /**
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 33d348105e3..1baa667c04d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -1113,8 +1113,7 @@ public final class GridDhtColocatedLockFuture extends 
GridCacheCompoundIdentityF
                                 req.addKeyBytes(
                                     key,
                                     retval,
-                                    dhtVer, // Include DHT version to match 
remote DHT entry.
-                                    cctx);
+                                    dhtVer); // Include DHT version to match 
remote DHT entry.
                             }
 
                             explicit = inTx() && cand == null;
@@ -1221,7 +1220,7 @@ public final class GridDhtColocatedLockFuture extends 
GridCacheCompoundIdentityF
         final ClusterNode node = map.node();
 
         if (filter != null && filter.length != 0)
-            req.filter(filter, cctx);
+            req.filter(filter);
 
         if (node.isLocal())
             lockLocally(mappedKeys, req.topologyVersion());
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 2fa955abbdd..4f8d6282e89 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -288,14 +288,14 @@ public class GridNearGetRequest extends 
GridCacheIdMessage implements GridCacheD
      * @param ctx Cache context.
      * @throws IgniteCheckedException If failed.
      */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         assert ctx != null;
         assert !F.isEmpty(keys);
         assert readersFlags == null || keys.size() == readersFlags.size();
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         prepareMarshalCacheObjects(keys, cctx);
     }
@@ -305,10 +305,10 @@ public class GridNearGetRequest extends 
GridCacheIdMessage implements GridCacheD
      * @param ldr Loader.
      * @throws IgniteCheckedException If failed.
      */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         finishUnmarshalCacheObjects(keys, cctx, ldr);
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
index 50e3dcdef4e..96acb7f5ff6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
@@ -131,7 +131,7 @@ public class GridNearGetResponse extends GridCacheIdMessage 
implements GridCache
      * @return Entries.
      */
     public Collection<GridCacheEntryInfo> entries() {
-        return entries != null ? entries : 
Collections.<GridCacheEntryInfo>emptyList();
+        return entries != null ? entries : Collections.emptyList();
     }
 
     /**
@@ -178,10 +178,10 @@ public class GridNearGetResponse extends 
GridCacheIdMessage implements GridCache
 
     /** {@inheritDoc}
      * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         if (entries != null) {
             for (GridCacheEntryInfo info : entries)
@@ -193,10 +193,10 @@ public class GridNearGetResponse extends 
GridCacheIdMessage implements GridCache
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId());
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId());
 
         if (entries != null) {
             for (GridCacheEntryInfo info : entries)
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index a6fc36c1959..07590718dcc 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -1121,9 +1121,8 @@ public final class GridNearLockFuture extends 
GridCacheCompoundIdentityFuture<Bo
                                         req.addKeyBytes(
                                             key,
                                             retval && dhtVer == null,
-                                            dhtVer,
-                                            // Include DHT version to match 
remote DHT entry.
-                                            cctx);
+                                            dhtVer); // Include DHT version to 
match remote DHT entry.
+
                                     }
 
                                     if (cand.reentry())
@@ -1215,7 +1214,7 @@ public final class GridNearLockFuture extends 
GridCacheCompoundIdentityFuture<Bo
         final ClusterNode node = map.node();
 
         if (filter != null && filter.length != 0)
-            req.filter(filter, cctx);
+            req.filter(filter);
 
         if (node.isLocal()) {
             req.miniId(-1);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 21509ce5a00..6106872d834 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -249,11 +249,8 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
 
     /**
      * @param filter Filter.
-     * @param ctx Context.
-     * @throws IgniteCheckedException If failed.
      */
-    public void filter(CacheEntryPredicate[] filter, GridCacheContext ctx)
-        throws IgniteCheckedException {
+    public void filter(CacheEntryPredicate[] filter) {
         this.filter = filter;
     }
 
@@ -284,19 +281,12 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
      * @param key Key.
      * @param retVal Flag indicating whether value should be returned.
      * @param dhtVer DHT version.
-     * @param ctx Context.
-     * @throws IgniteCheckedException If failed.
      */
-    public void addKeyBytes(
-        KeyCacheObject key,
-        boolean retVal,
-        @Nullable GridCacheVersion dhtVer,
-        GridCacheContext ctx
-    ) throws IgniteCheckedException {
+    public void addKeyBytes(KeyCacheObject key, boolean retVal, @Nullable 
GridCacheVersion dhtVer) {
         dhtVers[idx] = dhtVer;
 
         // Delegate to super.
-        addKeyBytes(key, retVal, ctx);
+        addKeyBytes(key, retVal);
     }
 
     /**
@@ -329,11 +319,11 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (filter != null) {
-            GridCacheContext cctx = ctx.cacheContext(cacheId);
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
             for (CacheEntryPredicate p : filter) {
                 if (p != null)
@@ -343,11 +333,11 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (filter != null) {
-            GridCacheContext cctx = ctx.cacheContext(cacheId);
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
             for (CacheEntryPredicate p : filter) {
                 if (p != null)
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
index 834ccb13463..4b20ed277be 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetRequest.java
@@ -251,23 +251,23 @@ public class GridNearSingleGetRequest extends 
GridCacheIdMessage implements Grid
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         assert key != null;
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         prepareMarshalCacheObject(key, cctx);
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         assert key != null;
 
-        GridCacheContext cctx = ctx.cacheContext(cacheId);
+        GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
         key.finishUnmarshal(cctx.cacheObjectContext(), ldr);
     }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
index 455ee3a4f8c..0c8b715ad33 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
@@ -96,7 +96,7 @@ public class GridNearSingleGetResponse extends 
GridCacheIdMessage implements Gri
         this.addDepInfo = addDepInfo;
 
         if (invalidPartitions)
-            flags = (byte)(flags | INVALID_PART_FLAG_MASK);
+            flags |= INVALID_PART_FLAG_MASK;
     }
 
     /**
@@ -136,7 +136,7 @@ public class GridNearSingleGetResponse extends 
GridCacheIdMessage implements Gri
      *
      */
     public void setContainsValue() {
-        flags = (byte)(flags | CONTAINS_VAL_FLAG_MASK);
+        flags |= CONTAINS_VAL_FLAG_MASK;
     }
 
     /**
@@ -154,11 +154,11 @@ public class GridNearSingleGetResponse extends 
GridCacheIdMessage implements Gri
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (res != null) {
-            GridCacheContext cctx = ctx.cacheContext(cacheId);
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);
 
             if (res instanceof CacheObject)
                 prepareMarshalCacheObject((CacheObject)res, cctx);
@@ -173,11 +173,11 @@ public class GridNearSingleGetResponse extends 
GridCacheIdMessage implements Gri
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (res != null) {
-            GridCacheContext cctx = ctx.cacheContext(cacheId());
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId());
 
             if (res instanceof CacheObject)
                 ((CacheObject)res).finishUnmarshal(cctx.cacheObjectContext(), 
ldr);
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 26789218f92..5191fce6146 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
@@ -131,7 +131,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
 
         if (F.isEmpty(keys))
-            return new GridFinishedFuture<>(Collections.<K, V>emptyMap());
+            return new GridFinishedFuture<>(Collections.emptyMap());
 
         warnIfUnordered(keys, BulkOperation.GET);
 
@@ -431,7 +431,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
         assert nodeId != null;
         assert res != null;
 
-        GridNearLockFuture fut = 
(GridNearLockFuture)ctx.mvcc().<Boolean>versionedFuture(res.version(),
+        GridNearLockFuture fut = 
(GridNearLockFuture)ctx.mvcc().versionedFuture(res.version(),
             res.futureId());
 
         if (fut != null)
@@ -494,8 +494,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
             if (log.isDebugEnabled())
                 log.debug("Evicting dht-local entry from near cache [entry=" + 
e + ", tx=" + this + ']');
 
-            if (e.markObsolete(obsoleteVer))
-                return true;
+            return e.markObsolete(obsoleteVer);
         }
 
         return false;
@@ -578,7 +577,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
                                     if (!primary.isLocal()) {
                                         assert req != null;
 
-                                        req.addKey(entry.key(), ctx);
+                                        req.addKey(entry.key());
                                     }
                                     else
                                         locKeys.add(cacheKey);
@@ -594,9 +593,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
 
                         assert !topVer.equals(AffinityTopologyVersion.NONE) || 
cand == null;
 
-                        if (topVer.equals(AffinityTopologyVersion.NONE))
-                            topVer = ctx.affinity().affinityTopologyVersion();
-
                         entry.touch();
 
                         break;
@@ -697,7 +693,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
                                         continue;
                                     }
 
-                                    req.addKey(entry.key(), ctx);
+                                    req.addKey(entry.key());
                                 }
                             }
                         }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
index 5f6f6bcf5b2..79f773a928a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
@@ -101,9 +101,8 @@ public class GridNearTxFinishResponse extends 
GridDistributedTxFinishResponse {
         return nearThreadId;
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (err != null && errBytes == null)
@@ -111,7 +110,7 @@ public class GridNearTxFinishResponse extends 
GridDistributedTxFinishResponse {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (errBytes != null && err == null)
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index bb8d1233bbb..adb0e3efb69 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@ -270,7 +270,7 @@ public class GridNearTxPrepareRequest extends 
GridDistributedTxPrepareRequest {
         Collection<IgniteTxEntry> cp = new ArrayList<>(c.size());
 
         for (IgniteTxEntry e : c) {
-            GridCacheContext cacheCtx = e.context();
+            GridCacheContext<?, ?> cacheCtx = e.context();
 
             // Clone only if it is a near cache.
             if (cacheCtx.isNear())
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index beb94aea6ab..20ad562cf94 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -228,9 +228,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
      * @return Owned values map.
      */
     public Map<IgniteTxKey, CacheVersionedValue> ownedValues() {
-        return ownedVals == null ?
-            Collections.<IgniteTxKey, CacheVersionedValue>emptyMap() :
-            Collections.unmodifiableMap(ownedVals);
+        return ownedVals == null ? Collections.emptyMap() : 
Collections.unmodifiableMap(ownedVals);
     }
 
     /**
@@ -251,7 +249,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
      * @return Collection of keys that did not pass the filter.
      */
     public Collection<IgniteTxKey> filterFailedKeys() {
-        return filterFailedKeys == null ? Collections.<IgniteTxKey>emptyList() 
: filterFailedKeys;
+        return filterFailedKeys == null ? Collections.emptyList() : 
filterFailedKeys;
     }
 
     /**
@@ -264,7 +262,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
 
     /** {@inheritDoc}
      * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (ownedVals != null && ownedValKeys == null) {
@@ -273,7 +271,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
             ownedValVals = ownedVals.values();
 
             for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : 
ownedVals.entrySet()) {
-                GridCacheContext cacheCtx = 
ctx.cacheContext(entry.getKey().cacheId());
+                GridCacheContext<?, ?> cacheCtx = 
ctx.cacheContext(entry.getKey().cacheId());
 
                 entry.getKey().prepareMarshal(cacheCtx);
 
@@ -282,7 +280,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
         }
 
         if (retVal != null && retVal.cacheId() != 0) {
-            GridCacheContext cctx = ctx.cacheContext(retVal.cacheId());
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(retVal.cacheId());
 
             assert cctx != null : retVal.cacheId();
 
@@ -291,7 +289,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
 
         if (filterFailedKeys != null) {
             for (IgniteTxKey key : filterFailedKeys) {
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 key.prepareMarshal(cctx);
             }
@@ -299,7 +297,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (ownedValKeys != null && ownedVals == null) {
@@ -314,7 +312,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
             while (keyIter.hasNext()) {
                 IgniteTxKey key = keyIter.next();
 
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 CacheVersionedValue val = valIter.next();
 
@@ -327,7 +325,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
         }
 
         if (retVal != null && retVal.cacheId() != 0) {
-            GridCacheContext cctx = ctx.cacheContext(retVal.cacheId());
+            GridCacheContext<?, ?> cctx = ctx.cacheContext(retVal.cacheId());
 
             assert cctx != null : retVal.cacheId();
 
@@ -336,7 +334,7 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
 
         if (filterFailedKeys != null) {
             for (IgniteTxKey key :filterFailedKeys) {
-                GridCacheContext cctx = ctx.cacheContext(key.cacheId());
+                GridCacheContext<?, ?> cctx = ctx.cacheContext(key.cacheId());
 
                 key.finishUnmarshal(cctx, ldr);
             }
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 921c789d718..9c8562cee4e 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
@@ -83,7 +83,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
      * @throws IgniteCheckedException If unmarshalling failed.
      */
     public GridNearTxRemote(
-        GridCacheSharedContext ctx,
+        GridCacheSharedContext<?, ?> ctx,
         AffinityTopologyVersion topVer,
         ClassLoader ldr,
         UUID nodeId,
@@ -162,7 +162,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
      * @param txLbl Transaction label.
      */
     public GridNearTxRemote(
-        GridCacheSharedContext ctx,
+        GridCacheSharedContext<?, ?> ctx,
         AffinityTopologyVersion topVer,
         UUID nodeId,
         UUID nearNodeId,
@@ -237,7 +237,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public void addActiveCache(GridCacheContext cacheCtx, boolean 
recovery) {
+    @Override public void addActiveCache(GridCacheContext<?, ?> cacheCtx, 
boolean recovery) {
         throw new UnsupportedOperationException("Near tx doesn't track active 
caches.");
     }
 
@@ -348,7 +348,7 @@ public class GridNearTxRemote extends 
GridDistributedTxRemoteAdapter {
      * @return {@code True} if entry has been enlisted.
      */
     public boolean addEntry(
-        GridCacheContext cacheCtx,
+        GridCacheContext<?, ?> cacheCtx,
         IgniteTxKey key,
         GridCacheOperation op,
         CacheObject val,
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 64aee86418e..0a36d340880 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
@@ -1896,7 +1896,7 @@ public abstract class IgniteTxAdapter extends 
GridMetadataAwareAdapter implement
      * @throws IgniteCheckedException If caches already enlisted in this 
transaction are not compatible with given
      *      cache (e.g. they have different stores).
      */
-    public abstract void addActiveCache(GridCacheContext cacheCtx, boolean 
recovery) throws IgniteCheckedException;
+    public abstract void addActiveCache(GridCacheContext<?, ?> cacheCtx, 
boolean recovery) throws IgniteCheckedException;
 
     /** {@inheritDoc} */
     @Override public TxCounters txCounters(boolean createIfAbsent) {
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 ed89cf1a235..ff71005cd2a 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
@@ -1300,7 +1300,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter implements Ig
     }
 
     /** {@inheritDoc} */
-    @Override public final void addActiveCache(GridCacheContext cacheCtx, 
boolean recovery) throws IgniteCheckedException {
+    @Override public final void addActiveCache(GridCacheContext<?, ?> 
cacheCtx, boolean recovery) throws IgniteCheckedException {
         txState.addActiveCache(cacheCtx, recovery, this);
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
index 86109c8f323..36bca5d8e9c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksRequest.java
@@ -105,7 +105,7 @@ public class TxLocksRequest extends GridCacheMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         txKeysArr = new IgniteTxKey[txKeys.size()];
@@ -120,7 +120,7 @@ public class TxLocksRequest extends GridCacheMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         txKeys = U.newHashSet(txKeysArr.length);
@@ -207,9 +207,4 @@ public class TxLocksRequest extends GridCacheMessage {
     @Override public byte fieldsCount() {
         return 5;
     }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        // No-op.
-    }
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
index df5caa978b6..cdf913c7bd5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
@@ -47,7 +47,7 @@ public class TxLocksResponse extends GridCacheMessage {
     /** Locks for near txKeys of near transactions. */
     @GridToStringInclude
     @GridDirectTransient
-    private Map<IgniteTxKey, TxLockList> nearTxKeyLocks = new HashMap<>();
+    private final Map<IgniteTxKey, TxLockList> nearTxKeyLocks = new 
HashMap<>();
 
     /** Remote keys involved into transactions. Doesn't include near keys. */
     @GridToStringInclude
@@ -153,7 +153,7 @@ public class TxLocksResponse extends GridCacheMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
+    @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
 
         if (nearTxKeyLocks != null && !nearTxKeyLocks.isEmpty()) {
@@ -190,7 +190,7 @@ public class TxLocksResponse extends GridCacheMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, 
ClassLoader ldr) throws IgniteCheckedException {
+    @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, 
ClassLoader ldr) throws IgniteCheckedException {
         try {
             super.finishUnmarshal(ctx, ldr);
 
@@ -325,9 +325,4 @@ public class TxLocksResponse extends GridCacheMessage {
     @Override public byte fieldsCount() {
         return 7;
     }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        // No-op.
-    }
 }


Reply via email to