ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/17] incubator-ignite git commit: # ignite-51
Date Tue, 24 Feb 2015 14:36:18 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index d125c02..0692f3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -37,6 +37,7 @@ import org.jdk8.backport.*;
 import org.jetbrains.annotations.*;
 
 import java.io.*;
+import java.security.*;
 import java.util.*;
 import java.util.concurrent.*;
 
@@ -47,42 +48,42 @@ import static org.jdk8.backport.ConcurrentLinkedHashMap.QueuePolicy.*;
 /**
  * Manages lock order within a thread.
  */
-public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K, V> {
+public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
     /** Maxim number of removed locks. */
     private static final int MAX_REMOVED_LOCKS = 10240;
 
     /** Pending locks per thread. */
-    private final GridThreadLocal<Queue<GridCacheMvccCandidate<K>>> pending =
-        new GridThreadLocal<Queue<GridCacheMvccCandidate<K>>>() {
-            @Override protected Queue<GridCacheMvccCandidate<K>> initialValue() {
+    private final GridThreadLocal<Queue<GridCacheMvccCandidate>> pending =
+        new GridThreadLocal<Queue<GridCacheMvccCandidate>>() {
+            @Override protected Queue<GridCacheMvccCandidate> initialValue() {
                 return new LinkedList<>();
             }
         };
 
     /** Pending near local locks and topology version per thread. */
-    private ConcurrentMap<Long, GridCacheExplicitLockSpan<K>> pendingExplicit;
+    private ConcurrentMap<Long, GridCacheExplicitLockSpan> pendingExplicit;
 
     /** Set of removed lock versions. */
     private Collection<GridCacheVersion> rmvLocks =
         new GridBoundedConcurrentLinkedHashSet<>(MAX_REMOVED_LOCKS, MAX_REMOVED_LOCKS, 0.75f, 16, PER_SEGMENT_Q);
 
     /** Current local candidates. */
-    private Collection<GridCacheMvccCandidate<K>> dhtLocCands = new ConcurrentSkipListSet<>();
+    private Collection<GridCacheMvccCandidate> dhtLocCands = new ConcurrentSkipListSet<>();
 
     /** Locked keys. */
     @GridToStringExclude
-    private final ConcurrentMap<IgniteTxKey<K>, GridDistributedCacheEntry<K, V>> locked = newMap();
+    private final ConcurrentMap<IgniteTxKey, GridDistributedCacheEntry> locked = newMap();
 
     /** Near locked keys. Need separate map because mvcc manager is shared between caches. */
     @GridToStringExclude
-    private final ConcurrentMap<IgniteTxKey<K>, GridDistributedCacheEntry<K, V>> nearLocked = newMap();
+    private final ConcurrentMap<IgniteTxKey, GridDistributedCacheEntry> nearLocked = newMap();
 
     /** Active futures mapped by version ID. */
     @GridToStringExclude
     private final ConcurrentMap<GridCacheVersion, Collection<GridCacheFuture<?>>> futs = newMap();
 
     /** Pending atomic futures. */
-    private final ConcurrentMap<GridCacheVersion, GridCacheAtomicFuture<K, ?>> atomicFuts =
+    private final ConcurrentMap<GridCacheVersion, GridCacheAtomicFuture<KeyCacheObject, ?>> atomicFuts =
         new ConcurrentHashMap8<>();
 
     /** Near to DHT version mapping. */
@@ -97,11 +98,11 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
 
     /** Lock callback. */
     @GridToStringExclude
-    private final GridCacheMvccCallback<K, V> cb = new GridCacheMvccCallback<K, V>() {
+    private final GridCacheMvccCallback cb = new GridCacheMvccCallback() {
         /** {@inheritDoc} */
         @SuppressWarnings({"unchecked"})
-        @Override public void onOwnerChanged(GridCacheEntryEx<K, V> entry, GridCacheMvccCandidate<K> prev,
-            GridCacheMvccCandidate<K> owner) {
+        @Override public void onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate prev,
+            GridCacheMvccCandidate owner) {
             assert entry != null;
             assert owner != prev : "New and previous owner are identical instances: " + owner;
             assert owner == null || prev == null || !owner.version().equals(prev.version()) :
@@ -117,8 +118,8 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
                 if (futCol != null) {
                     for (GridCacheFuture fut : futCol) {
                         if (fut instanceof GridCacheMvccFuture && !fut.isDone()) {
-                            GridCacheMvccFuture<K, V, Boolean> mvccFut =
-                                (GridCacheMvccFuture<K, V, Boolean>)fut;
+                            GridCacheMvccFuture<Boolean> mvccFut =
+                                (GridCacheMvccFuture<Boolean>)fut;
 
                             // Since this method is called outside of entry synchronization,
                             // we can safely invoke any method on the future.
@@ -148,7 +149,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
         }
 
         /** {@inheritDoc} */
-        @Override public void onLocked(GridDistributedCacheEntry<K, V> entry) {
+        @Override public void onLocked(GridDistributedCacheEntry entry) {
             if (entry.isNear())
                 nearLocked.put(entry.txKey(), entry);
             else
@@ -156,7 +157,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
         }
 
         /** {@inheritDoc} */
-        @Override public void onFreed(GridDistributedCacheEntry<K, V> entry) {
+        @Override public void onFreed(GridDistributedCacheEntry entry) {
             if (entry.isNear())
                 nearLocked.remove(entry.txKey());
             else
@@ -175,7 +176,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
             if (log.isDebugEnabled())
                 log.debug("Processing node left [nodeId=" + discoEvt.eventNode().id() + "]");
 
-            for (GridDistributedCacheEntry<K, V> entry : locked()) {
+            for (GridDistributedCacheEntry entry : locked()) {
                 try {
                     entry.removeExplicitNodeLocks(discoEvt.eventNode().id());
                 }
@@ -235,7 +236,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
     /**
      * @return MVCC callback.
      */
-    public GridCacheMvccCallback<K, V> callback() {
+    public GridCacheMvccCallback callback() {
         return cb;
     }
 
@@ -314,7 +315,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param futVer Future ID.
      * @param fut Future.
      */
-    public void addAtomicFuture(GridCacheVersion futVer, GridCacheAtomicFuture<K, ?> fut) {
+    public void addAtomicFuture(GridCacheVersion futVer, GridCacheAtomicFuture<KeyCacheObject, ?> fut) {
         IgniteInternalFuture<?> old = atomicFuts.put(futVer, fut);
 
         assert old == null;
@@ -323,7 +324,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
     /**
      * @return Collection of pending atomic futures.
      */
-    public Collection<GridCacheAtomicFuture<K, ?>> atomicFutures() {
+    public Collection<GridCacheAtomicFuture<KeyCacheObject, ?>> atomicFutures() {
         return atomicFuts.values();
     }
 
@@ -523,7 +524,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param ver Lock version to check.
      * @return {@code True} if lock had been removed.
      */
-    public boolean isRemoved(GridCacheContext<K, V> cacheCtx, GridCacheVersion ver) {
+    public boolean isRemoved(GridCacheContext cacheCtx, GridCacheVersion ver) {
         return !cacheCtx.isNear() && !cacheCtx.isLocal() && ver != null && rmvLocks.contains(ver);
     }
 
@@ -531,7 +532,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param ver Obsolete entry version.
      * @return {@code True} if added.
      */
-    public boolean addRemoved(GridCacheContext<K, V> cacheCtx, GridCacheVersion ver) {
+    public boolean addRemoved(GridCacheContext cacheCtx, GridCacheVersion ver) {
         if (cacheCtx.isNear() || cacheCtx.isLocal())
             return true;
 
@@ -546,7 +547,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
     /**
      * @return Collection of all locked entries.
      */
-    private Collection<GridDistributedCacheEntry<K, V>> locked() {
+    private Collection<GridDistributedCacheEntry> locked() {
         return F.concat(false, locked.values(), nearLocked.values());
     }
 
@@ -555,10 +556,10 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      *
      * @return Remote candidates.
      */
-    public Collection<GridCacheMvccCandidate<K>> remoteCandidates() {
-        Collection<GridCacheMvccCandidate<K>> rmtCands = new LinkedList<>();
+    public Collection<GridCacheMvccCandidate> remoteCandidates() {
+        Collection<GridCacheMvccCandidate> rmtCands = new LinkedList<>();
 
-        for (GridDistributedCacheEntry<K, V> entry : locked()) {
+        for (GridDistributedCacheEntry entry : locked()) {
             rmtCands.addAll(entry.remoteMvccSnapshot());
         }
 
@@ -570,10 +571,10 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      *
      * @return Local candidates.
      */
-    public Collection<GridCacheMvccCandidate<K>> localCandidates() {
-        Collection<GridCacheMvccCandidate<K>> locCands = new LinkedList<>();
+    public Collection<GridCacheMvccCandidate> localCandidates() {
+        Collection<GridCacheMvccCandidate> locCands = new LinkedList<>();
 
-        for (GridDistributedCacheEntry<K, V> entry : locked()) {
+        for (GridDistributedCacheEntry entry : locked()) {
             try {
                 locCands.addAll(entry.localCandidates());
             }
@@ -589,7 +590,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param cand Local lock.
      * @return {@code True} if added.
      */
-    public boolean addLocal(GridCacheMvccCandidate<K> cand) {
+    public boolean addLocal(GridCacheMvccCandidate cand) {
         assert cand.key() != null;
         assert cand.local();
 
@@ -608,7 +609,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param cand Local candidate to remove.
      * @return {@code True} if removed.
      */
-    public boolean removeLocal(GridCacheMvccCandidate<K> cand) {
+    public boolean removeLocal(GridCacheMvccCandidate cand) {
         assert cand.key() != null;
         assert cand.local();
 
@@ -627,10 +628,10 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param base Base version.
      * @return Versions that are less than {@code base} whose keys are in the {@code keys} collection.
      */
-    public Collection<GridCacheVersion> localDhtPendingVersions(Collection<K> keys, GridCacheVersion base) {
+    public Collection<GridCacheVersion> localDhtPendingVersions(Collection<KeyCacheObject> keys, GridCacheVersion base) {
         Collection<GridCacheVersion> lessPending = new GridLeanSet<>(5);
 
-        for (GridCacheMvccCandidate<K> cand : dhtLocCands) {
+        for (GridCacheMvccCandidate cand : dhtLocCands) {
             if (cand.version().isLess(base)) {
                 if (keys.contains(cand.key()))
                     lessPending.add(cand.version());
@@ -647,11 +648,11 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      *
      * @param cand Lock candidate to unlink.
      */
-    private void unlink(GridCacheMvccCandidate<K> cand) {
-        GridCacheMvccCandidate<K> next = cand.next();
+    private void unlink(GridCacheMvccCandidate cand) {
+        GridCacheMvccCandidate next = cand.next();
 
         if (next != null) {
-            GridCacheMvccCandidate<K> prev = cand.previous();
+            GridCacheMvccCandidate prev = cand.previous();
 
             next.previous(prev);
 
@@ -677,7 +678,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @return {@code True} if added as a result of this operation,
      *      {@code false} if was previously added.
      */
-    public boolean addNext(GridCacheContext<K, V> cacheCtx, GridCacheMvccCandidate<K> cand) {
+    public boolean addNext(GridCacheContext cacheCtx, GridCacheMvccCandidate cand) {
         assert cand != null;
         assert !cand.reentry() : "Lock reentries should not be linked: " + cand;
 
@@ -686,14 +687,14 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
         if (cacheCtx.isNear() || cand.singleImplicit())
             return true;
 
-        Queue<GridCacheMvccCandidate<K>> queue = pending.get();
+        Queue<GridCacheMvccCandidate> queue = pending.get();
 
         boolean add = true;
 
-        GridCacheMvccCandidate<K> prev = null;
+        GridCacheMvccCandidate prev = null;
 
-        for (Iterator<GridCacheMvccCandidate<K>> it = queue.iterator(); it.hasNext(); ) {
-            GridCacheMvccCandidate<K> c = it.next();
+        for (Iterator<GridCacheMvccCandidate> it = queue.iterator(); it.hasNext(); ) {
+            GridCacheMvccCandidate c = it.next();
 
             if (c.equals(cand))
                 add = false;
@@ -732,14 +733,14 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param cand Candidate to add.
      * @param snapshot Topology snapshot.
      */
-    public void addExplicitLock(long threadId, GridCacheMvccCandidate<K> cand, GridDiscoveryTopologySnapshot snapshot) {
+    public void addExplicitLock(long threadId, GridCacheMvccCandidate cand, GridDiscoveryTopologySnapshot snapshot) {
         while (true) {
-            GridCacheExplicitLockSpan<K> span = pendingExplicit.get(cand.threadId());
+            GridCacheExplicitLockSpan span = pendingExplicit.get(cand.threadId());
 
             if (span == null) {
-                span = new GridCacheExplicitLockSpan<>(snapshot, cand);
+                span = new GridCacheExplicitLockSpan(snapshot, cand);
 
-                GridCacheExplicitLockSpan<K> old = pendingExplicit.putIfAbsent(threadId, span);
+                GridCacheExplicitLockSpan old = pendingExplicit.putIfAbsent(threadId, span);
 
                 if (old == null)
                     break;
@@ -760,8 +761,8 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      *
      * @param cand Candidate to remove.
      */
-    public void removeExplicitLock(GridCacheMvccCandidate<K> cand) {
-        GridCacheExplicitLockSpan<K> span = pendingExplicit.get(cand.threadId());
+    public void removeExplicitLock(GridCacheMvccCandidate cand) {
+        GridCacheExplicitLockSpan span = pendingExplicit.get(cand.threadId());
 
         if (span == null)
             return;
@@ -777,20 +778,20 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param threadId Thread id. If -1, all threads will be checked.
      * @return {@code True} if locked by any or given thread (depending on {@code threadId} value).
      */
-    public boolean isLockedByThread(K key, long threadId) {
+    public boolean isLockedByThread(KeyCacheObject key, long threadId) {
         if (threadId < 0) {
-            for (GridCacheExplicitLockSpan<K> span : pendingExplicit.values()) {
-                GridCacheMvccCandidate<K> cand = span.candidate(key, null);
+            for (GridCacheExplicitLockSpan span : pendingExplicit.values()) {
+                GridCacheMvccCandidate cand = span.candidate(key, null);
 
                 if (cand != null && cand.owner())
                     return true;
             }
         }
         else {
-            GridCacheExplicitLockSpan<K> span = pendingExplicit.get(threadId);
+            GridCacheExplicitLockSpan span = pendingExplicit.get(threadId);
 
             if (span != null) {
-                GridCacheMvccCandidate<K> cand = span.candidate(key, null);
+                GridCacheMvccCandidate cand = span.candidate(key, null);
 
                 return cand != null && cand.owner();
             }
@@ -805,10 +806,10 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param key Key.
      * @param threadId Thread id.
      */
-    public void markExplicitOwner(K key, long threadId) {
+    public void markExplicitOwner(KeyCacheObject key, long threadId) {
         assert threadId > 0;
 
-        GridCacheExplicitLockSpan<K> span = pendingExplicit.get(threadId);
+        GridCacheExplicitLockSpan span = pendingExplicit.get(threadId);
 
         if (span != null)
             span.markOwned(key);
@@ -822,15 +823,18 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param ver Optional version.
      * @return Candidate.
      */
-    public GridCacheMvccCandidate<K> removeExplicitLock(long threadId, K key, @Nullable GridCacheVersion ver) {
+    public GridCacheMvccCandidate removeExplicitLock(long threadId,
+        KeyCacheObject key,
+        @Nullable GridCacheVersion ver)
+    {
         assert threadId > 0;
 
-        GridCacheExplicitLockSpan<K> span = pendingExplicit.get(threadId);
+        GridCacheExplicitLockSpan span = pendingExplicit.get(threadId);
 
         if (span == null)
             return null;
 
-        GridCacheMvccCandidate<K> cand = span.removeCandidate(key, ver);
+        GridCacheMvccCandidate cand = span.removeCandidate(key, ver);
 
         if (cand != null && span.isEmpty())
             pendingExplicit.remove(cand.threadId(), span);
@@ -846,11 +850,11 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @return Last added explicit lock candidate for given thread id and key or {@code null} if
      *      no such candidate.
      */
-    @Nullable public GridCacheMvccCandidate<K> explicitLock(long threadId, K key) {
+    @Nullable public GridCacheMvccCandidate explicitLock(long threadId, KeyCacheObject key) {
         if (threadId < 0)
             return explicitLock(key, null);
         else {
-            GridCacheExplicitLockSpan<K> span = pendingExplicit.get(threadId);
+            GridCacheExplicitLockSpan span = pendingExplicit.get(threadId);
 
             return span == null ? null : span.candidate(key, null);
         }
@@ -863,9 +867,9 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param ver Version.
      * @return Lock candidate that satisfies given criteria or {@code null} if no such candidate.
      */
-    @Nullable public GridCacheMvccCandidate<K> explicitLock(K key, @Nullable GridCacheVersion ver) {
-        for (GridCacheExplicitLockSpan<K> span : pendingExplicit.values()) {
-            GridCacheMvccCandidate<K> cand = span.candidate(key, ver);
+    @Nullable public GridCacheMvccCandidate explicitLock(KeyCacheObject key, @Nullable GridCacheVersion ver) {
+        for (GridCacheExplicitLockSpan span : pendingExplicit.values()) {
+            GridCacheMvccCandidate cand = span.candidate(key, ver);
 
             if (cand != null)
                 return cand;
@@ -879,7 +883,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @return Topology snapshot for last acquired and not released lock.
      */
     @Nullable public GridDiscoveryTopologySnapshot lastExplicitLockTopologySnapshot(long threadId) {
-        GridCacheExplicitLockSpan<K> span = pendingExplicit.get(threadId);
+        GridCacheExplicitLockSpan span = pendingExplicit.get(threadId);
 
         return span != null ? span.topologySnapshot() : null;
     }
@@ -901,12 +905,12 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param nodeId Node ID.
      * @return Filter.
      */
-    private IgnitePredicate<GridCacheMvccCandidate<K>> nodeIdFilter(final UUID nodeId) {
+    private IgnitePredicate<GridCacheMvccCandidate> nodeIdFilter(final UUID nodeId) {
         if (nodeId == null)
             return F.alwaysTrue();
 
-        return new P1<GridCacheMvccCandidate<K>>() {
-            @Override public boolean apply(GridCacheMvccCandidate<K> c) {
+        return new P1<GridCacheMvccCandidate>() {
+            @Override public boolean apply(GridCacheMvccCandidate c) {
                 UUID otherId = c.otherNodeId();
 
                 return c.nodeId().equals(nodeId) || (otherId != null && otherId.equals(nodeId));
@@ -934,7 +938,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
     public IgniteInternalFuture<?> finishExplicitLocks(long topVer) {
         GridCompoundFuture<Object, Object> res = new GridCompoundFuture<>(cctx.kernalContext());
 
-        for (GridCacheExplicitLockSpan<K> span : pendingExplicit.values()) {
+        for (GridCacheExplicitLockSpan span : pendingExplicit.values()) {
             GridDiscoveryTopologySnapshot snapshot = span.topologySnapshot();
 
             if (snapshot != null && snapshot.topologyVersion() < topVer)
@@ -956,7 +960,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
 
         res.ignoreChildFailures(ClusterTopologyCheckedException.class, CachePartialUpdateCheckedException.class);
 
-        for (GridCacheAtomicFuture<K, ?> fut : atomicFuts.values()) {
+        for (GridCacheAtomicFuture<KeyCacheObject, ?> fut : atomicFuts.values()) {
             if (fut.waitForPartitionExchange() && fut.topologyVersion() < topVer)
                 res.add((IgniteInternalFuture<Object>)fut);
         }
@@ -972,14 +976,14 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @return Future that signals when all locks for given keys are released.
      */
     @SuppressWarnings("unchecked")
-    public IgniteInternalFuture<?> finishKeys(Collection<K> keys, long topVer) {
+    public IgniteInternalFuture<?> finishKeys(Collection<KeyCacheObject> keys, long topVer) {
         if (!(keys instanceof Set))
             keys = new HashSet<>(keys);
 
-        final Collection<K> keys0 = keys;
+        final Collection<KeyCacheObject> keys0 = keys;
 
-        return finishLocks(new P1<K>() {
-            @Override public boolean apply(K key) {
+        return finishLocks(new P1<KeyCacheObject>() {
+            @Override public boolean apply(KeyCacheObject key) {
                 return keys0.contains(key);
             }
         }, topVer);
@@ -990,7 +994,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
      * @param topVer Topology version.
      * @return Future that signals when all locks for given partitions will be released.
      */
-    private IgniteInternalFuture<?> finishLocks(@Nullable final IgnitePredicate<K> keyFilter, long topVer) {
+    private IgniteInternalFuture<?> finishLocks(@Nullable final IgnitePredicate<KeyCacheObject> keyFilter, long topVer) {
         assert topVer != 0;
 
         if (topVer < 0)
@@ -1000,8 +1004,8 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
             keyFilter == null ?
                 locked() :
                 F.view(locked(),
-                    new P1<GridDistributedCacheEntry<K, V>>() {
-                        @Override public boolean apply(GridDistributedCacheEntry<K, V> e) {
+                    new P1<GridDistributedCacheEntry>() {
+                        @Override public boolean apply(GridDistributedCacheEntry e) {
                             return F.isAll(e.key(), keyFilter);
                         }
                     }
@@ -1049,7 +1053,7 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
 
         /** */
         @GridToStringInclude
-        private final Map<IgniteTxKey<K>, Collection<GridCacheMvccCandidate<K>>> pendingLocks =
+        private final Map<IgniteTxKey, Collection<GridCacheMvccCandidate>> pendingLocks =
             new ConcurrentHashMap8<>();
 
         /**
@@ -1065,20 +1069,20 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
          * @param topVer Topology version.
          * @param entries Entries.
          */
-        FinishLockFuture(Iterable<GridDistributedCacheEntry<K, V>> entries, long topVer) {
+        FinishLockFuture(Iterable<GridDistributedCacheEntry> entries, long topVer) {
             super(cctx.kernalContext(), true);
 
             assert topVer > 0;
 
             this.topVer = topVer;
 
-            for (GridCacheEntryEx<K, V> entry : entries) {
+            for (GridCacheEntryEx entry : entries) {
                 // Either local or near local candidates.
                 try {
-                    Collection<GridCacheMvccCandidate<K>> locs = entry.localCandidates();
+                    Collection<GridCacheMvccCandidate> locs = entry.localCandidates();
 
                     if (!F.isEmpty(locs)) {
-                        Collection<GridCacheMvccCandidate<K>> cands =
+                        Collection<GridCacheMvccCandidate> cands =
                             new ConcurrentLinkedQueue<>();
 
                         if (locs != null)
@@ -1101,11 +1105,11 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
         /**
          * @return Filter.
          */
-        private IgnitePredicate<GridCacheMvccCandidate<K>> versionFilter() {
+        private IgnitePredicate<GridCacheMvccCandidate> versionFilter() {
             assert topVer > 0;
 
-            return new P1<GridCacheMvccCandidate<K>>() {
-                @Override public boolean apply(GridCacheMvccCandidate<K> c) {
+            return new P1<GridCacheMvccCandidate>() {
+                @Override public boolean apply(GridCacheMvccCandidate c) {
                     assert c.nearLocal() || c.dhtLocal();
 
                     // Wait for explicit locks.
@@ -1118,12 +1122,12 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
          *
          */
         void recheck() {
-            for (Iterator<IgniteTxKey<K>> it = pendingLocks.keySet().iterator(); it.hasNext(); ) {
-                IgniteTxKey<K> key = it.next();
+            for (Iterator<IgniteTxKey> it = pendingLocks.keySet().iterator(); it.hasNext(); ) {
+                IgniteTxKey key = it.next();
 
-                GridCacheContext<K, V> cacheCtx = cctx.cacheContext(key.cacheId());
+                GridCacheContext cacheCtx = cctx.cacheContext(key.cacheId());
 
-                GridCacheEntryEx<K, V> entry = cacheCtx.cache().peekEx(key.key());
+                GridCacheEntryEx entry = cacheCtx.cache().peekEx(key.key());
 
                 if (entry == null)
                     it.remove();
@@ -1146,19 +1150,19 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
          * @param entry Entry.
          */
         @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"})
-        void recheck(@Nullable GridCacheEntryEx<K, V> entry) {
+        void recheck(@Nullable GridCacheEntryEx entry) {
             if (entry == null)
                 return;
 
             if (exchLog.isDebugEnabled())
                 exchLog.debug("Rechecking entry for completion [entry=" + entry + ", finFut=" + this + ']');
 
-            Collection<GridCacheMvccCandidate<K>> cands = pendingLocks.get(entry.txKey());
+            Collection<GridCacheMvccCandidate> cands = pendingLocks.get(entry.txKey());
 
             if (cands != null) {
                 synchronized (cands) {
-                    for (Iterator<GridCacheMvccCandidate<K>> it = cands.iterator(); it.hasNext(); ) {
-                        GridCacheMvccCandidate<K> cand = it.next();
+                    for (Iterator<GridCacheMvccCandidate> it = cands.iterator(); it.hasNext(); ) {
+                        GridCacheMvccCandidate cand = it.next();
 
                         // Check exclude ID again, as key could have been reassigned.
                         if (cand.removed())
@@ -1183,9 +1187,9 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K,
             if (!pendingLocks.isEmpty()) {
                 Map<GridCacheVersion, IgniteInternalTx> txs = new HashMap<>(1, 1.0f);
 
-                for (Collection<GridCacheMvccCandidate<K>> cands : pendingLocks.values())
-                    for (GridCacheMvccCandidate<K> c : cands)
-                        txs.put(c.version(), cctx.tm().<IgniteInternalTx>tx(c.version()));
+                for (Collection<GridCacheMvccCandidate> cands : pendingLocks.values())
+                    for (GridCacheMvccCandidate c : cands)
+                        txs.put(c.version(), cctx.tm().tx(c.version()));
 
                 return S.toString(FinishLockFuture.class, this, "txs=" + txs + ", super=" + super.toString());
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index e800137..fa745ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -90,13 +90,13 @@ public interface GridCachePreloader<K, V> {
     /**
      * @param p Preload predicate.
      */
-    public void preloadPredicate(IgnitePredicate<GridCacheEntryInfo<K, V>> p);
+    public void preloadPredicate(IgnitePredicate<GridCacheEntryInfo> p);
 
     /**
      * @return Preload predicate. If not {@code null}, will evaluate each preloaded entry during
      *      send and receive, and if predicate evaluates to {@code false}, entry will be skipped.
      */
-    public IgnitePredicate<GridCacheEntryInfo<K, V>> preloadPredicate();
+    public IgnitePredicate<GridCacheEntryInfo> preloadPredicate();
 
     /**
      * @return Future which will complete when preloader is safe to use.
@@ -115,7 +115,7 @@ public interface GridCachePreloader<K, V> {
      * @param topVer Topology version, {@code -1} if not required.
      * @return Future to complete when all keys are preloaded.
      */
-    public IgniteInternalFuture<Object> request(Collection<? extends K> keys, long topVer);
+    public IgniteInternalFuture<Object> request(Collection<KeyCacheObject> keys, long topVer);
 
     /**
      * Force preload process.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index 40e090b..3c96dd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -44,7 +44,7 @@ public class GridCachePreloaderAdapter<K, V> implements GridCachePreloader<K, V>
     private final IgniteInternalFuture finFut;
 
     /** Preload predicate. */
-    protected IgnitePredicate<GridCacheEntryInfo<K, V>> preloadPred;
+    protected IgnitePredicate<GridCacheEntryInfo> preloadPred;
 
     /**
      * @param cctx Cache context.
@@ -86,12 +86,12 @@ public class GridCachePreloaderAdapter<K, V> implements GridCachePreloader<K, V>
     }
 
     /** {@inheritDoc} */
-    @Override public void preloadPredicate(IgnitePredicate<GridCacheEntryInfo<K, V>> preloadPred) {
+    @Override public void preloadPredicate(IgnitePredicate<GridCacheEntryInfo> preloadPred) {
         this.preloadPred = preloadPred;
     }
 
     /** {@inheritDoc} */
-    @Override public IgnitePredicate<GridCacheEntryInfo<K, V>> preloadPredicate() {
+    @Override public IgnitePredicate<GridCacheEntryInfo> preloadPredicate() {
         return preloadPred;
     }
 
@@ -111,7 +111,7 @@ public class GridCachePreloaderAdapter<K, V> implements GridCachePreloader<K, V>
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Object> request(Collection<? extends K> keys, long topVer) {
+    @Override public IgniteInternalFuture<Object> request(Collection<KeyCacheObject> keys, long topVer) {
         return new GridFinishedFuture<>(cctx.kernalContext());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index e99c706..80af968 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1492,9 +1492,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
             if (qryMgr != null) {
                 try {
-                    Object key = cctx.marshaller().unmarshal(keyBytes, cctx.shared().deploy().globalLoader());
+                    // TODO IGNITE-51.
+                    KeyCacheObject key = cctx.marshaller().unmarshal(keyBytes, cctx.shared().deploy().globalLoader());
 
-                    qryMgr.remove(key, keyBytes);
+                    qryMgr.remove(key);
                 }
                 catch (IgniteCheckedException e) {
                     U.error(log, "Failed to unmarshal key evicted from swap [swapSpaceName=" + spaceName + ']', e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
index 546208a..6cd73b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
@@ -62,7 +62,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Previous value.
      * @throws IgniteCheckedException If failed.
      */
-    @Nullable public V put(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Nullable public V put(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
@@ -75,7 +75,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @param filter Optional filter.
      * @return Put operation future.
      */
-    public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter);
 
     /**
@@ -89,7 +89,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Previous value.
      * @throws IgniteCheckedException If failed.
      */
-    public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    public boolean putx(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
@@ -102,7 +102,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @param filter Optional filter.
      * @return Putx operation future.
      */
-    public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter);
 
     /**
@@ -133,7 +133,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Previous value.
      * @throws IgniteCheckedException If failed.
      */
-    @Nullable public V remove(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Nullable public V remove(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
@@ -144,7 +144,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @param filter Optional filter.
      * @return Put operation future.
      */
-    public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter);
 
     /**
@@ -175,7 +175,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Previous value.
      * @throws IgniteCheckedException If failed.
      */
-    public boolean removex(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    public boolean removex(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
@@ -186,7 +186,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @param filter Optional filter.
      * @return Putx operation future.
      */
-    public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter);
 
     /**
@@ -212,7 +212,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws NullPointerException If either key or value are {@code null}.
      * @throws CacheFlagException If projection flags validation failed.
      */
-    public IgniteInternalFuture<GridCacheReturn<V>> replacexAsync(K key, V oldVal, V newVal);
+    public IgniteInternalFuture<GridCacheReturn<CacheObject>> replacexAsync(K key, V oldVal, V newVal);
 
     /**
      * Stores given key-value pair in cache only if only if the previous value is equal to the
@@ -237,7 +237,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If replace operation failed.
      * @throws CacheFlagException If projection flags validation failed.
      */
-    public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException;
+    public GridCacheReturn<CacheObject> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException;
 
     /**
      * Removes given key mapping from cache if one exists and value is equal to the passed in value.
@@ -258,7 +258,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If remove failed.
      * @throws CacheFlagException If projection flags validation failed.
      */
-    public GridCacheReturn<V> removex(K key, V val) throws IgniteCheckedException;
+    public GridCacheReturn<CacheObject> removex(K key, V val) throws IgniteCheckedException;
 
     /**
      * Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.
@@ -282,7 +282,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws NullPointerException if the key or value is {@code null}.
      * @throws CacheFlagException If projection flags validation failed.
      */
-    public IgniteInternalFuture<GridCacheReturn<V>> removexAsync(K key, V val);
+    public IgniteInternalFuture<GridCacheReturn<CacheObject>> removexAsync(K key, V val);
 
     /**
      * @param key Key to retrieve the value for.
@@ -292,7 +292,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Value.
      * @throws IgniteCheckedException If failed.
      */
-    @Nullable public V get(K key, @Nullable GridCacheEntryEx<K, V> entry, boolean deserializePortable,
+    @Nullable public V get(K key, @Nullable GridCacheEntryEx entry, boolean deserializePortable,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
index c8187f4..fc244ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
@@ -686,7 +686,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public V get(K key, @Nullable GridCacheEntryEx<K, V> entry, boolean deserializePortable,
+    @Override public V get(K key, @Nullable GridCacheEntryEx entry, boolean deserializePortable,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         return cache.get(key, entry, deserializePortable, and(filter, false));
     }
@@ -758,7 +758,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public V put(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Override public V put(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         return cache.put(key, val, entry, ttl, filter);
     }
@@ -770,7 +770,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Override public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) {
         A.notNull(key, "key", val, "val");
 
@@ -782,7 +782,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Override public boolean putx(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         return cache.putx(key, val, entry, ttl, filter);
     }
@@ -852,7 +852,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx entry,
         long ttl, @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) {
         A.notNull(key, "key", val, "val");
 
@@ -1113,7 +1113,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public V remove(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public V remove(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         return removeAsync(key, entry, filter).get();
     }
@@ -1124,7 +1124,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
         return cache.removeAsync(key, entry, and(filter, false));
     }
@@ -1146,7 +1146,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public boolean removex(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public boolean removex(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         return removexAsync(key, entry, filter).get();
     }
@@ -1158,36 +1158,36 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
         return cache.removexAsync(key, entry, and(filter, false));
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<GridCacheReturn<V>> replacexAsync(K key, V oldVal, V newVal) {
+    @Override public IgniteInternalFuture<GridCacheReturn<CacheObject>> replacexAsync(K key, V oldVal, V newVal) {
         A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal");
 
         // Check k-v predicate first.
         if (!isAll(key, newVal, true))
-            return new GridFinishedFuture<>(cctx.kernalContext(), new GridCacheReturn<V>(false));
+            return new GridFinishedFuture<>(cctx.kernalContext(), new GridCacheReturn<CacheObject>(false));
 
         return cache.replacexAsync(key, oldVal, newVal);
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException {
+    @Override public GridCacheReturn<CacheObject> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException {
         return replacexAsync(key, oldVal, newVal).get();
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheReturn<V> removex(K key, V val) throws IgniteCheckedException {
+    @Override public GridCacheReturn<CacheObject> removex(K key, V val) throws IgniteCheckedException {
         return removexAsync(key, val).get();
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<GridCacheReturn<V>> removexAsync(K key, V val) {
+    @Override public IgniteInternalFuture<GridCacheReturn<CacheObject>> removexAsync(K key, V val) {
         return !isAll(key, val, true) ? new GridFinishedFuture<>(cctx.kernalContext(),
-            new GridCacheReturn<V>(false)) : cache.removexAsync(key, val);
+            new GridCacheReturn<CacheObject>(false)) : cache.removexAsync(key, val);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 23ec81b..d1d773d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -503,7 +503,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public V get(K key, @Nullable GridCacheEntryEx<K, V> entry, boolean deserializePortable,
+    @Override public V get(K key, @Nullable GridCacheEntryEx entry, boolean deserializePortable,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -673,7 +673,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public V put(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Override public V put(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -699,7 +699,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Override public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -712,7 +712,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
+    @Override public boolean putx(K key, V val, @Nullable GridCacheEntryEx entry, long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -863,7 +863,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> putxAsync(K key,
         V val,
-        @Nullable GridCacheEntryEx<K, V> entry,
+        @Nullable GridCacheEntryEx entry,
         long ttl,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
@@ -1403,7 +1403,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public V remove(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public V remove(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -1428,7 +1428,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -1478,7 +1478,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public boolean removex(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public boolean removex(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -1504,7 +1504,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
+    @Override public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx entry,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
@@ -1517,7 +1517,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<GridCacheReturn<V>> replacexAsync(K key, V oldVal, V newVal) {
+    @Override public IgniteInternalFuture<GridCacheReturn<CacheObject>> replacexAsync(K key, V oldVal, V newVal) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
@@ -1529,7 +1529,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException {
+    @Override public GridCacheReturn<CacheObject> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
@@ -1541,7 +1541,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheReturn<V> removex(K key, V val) throws IgniteCheckedException {
+    @Override public GridCacheReturn<CacheObject> removex(K key, V val) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
@@ -1553,7 +1553,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<GridCacheReturn<V>> removexAsync(K key, V val) {
+    @Override public IgniteInternalFuture<GridCacheReturn<CacheObject>> removexAsync(K key, V val) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index 3e9047c..d515c0d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -180,7 +180,7 @@ public class GridCacheReturn<V> implements Externalizable, OptimizedMarshallable
     /**
      * @param other Other result to merge with.
      */
-    public synchronized void mergeEntryProcessResults(GridCacheReturn<V> other) {
+    public synchronized void mergeEntryProcessResults(GridCacheReturn<CacheObject> other) {
         assert invokeRes || v == null : "Invalid state to merge: " + this;
         assert other.invokeRes;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
index 065ddb4..6a7450c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
@@ -358,7 +358,7 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
     @SuppressWarnings({"unchecked"})
     public boolean loadAllFromStore(@Nullable IgniteInternalTx tx,
         Collection<? extends KeyCacheObject> keys,
-        final IgniteBiInClosure<Object, Object> vis) throws IgniteCheckedException {
+        final IgniteBiInClosure<KeyCacheObject, Object> vis) throws IgniteCheckedException {
         if (store != null) {
             loadAllFromStore(tx, keys, vis, null);
 
@@ -381,9 +381,9 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
      */
     @SuppressWarnings("unchecked")
     private void loadAllFromStore(@Nullable IgniteInternalTx tx,
-        Collection<Object> keys,
-        @Nullable final IgniteBiInClosure<Object, Object> vis,
-        @Nullable final GridInClosure3<Object, Object, GridCacheVersion> verVis)
+        Collection<? extends KeyCacheObject> keys,
+        @Nullable final IgniteBiInClosure<KeyCacheObject, Object> vis,
+        @Nullable final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> verVis)
         throws IgniteCheckedException {
         assert vis != null ^ verVis != null;
         assert verVis == null || locStore;
@@ -492,7 +492,7 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
      * @throws IgniteCheckedException If data loading failed.
      */
     @SuppressWarnings({"ErrorNotRethrown", "unchecked"})
-    public boolean loadCache(final GridInClosure3<Object, Object, GridCacheVersion> vis, Object[] args)
+    public boolean loadCache(final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> vis, Object[] args)
         throws IgniteCheckedException {
         if (store != null) {
             if (log.isDebugEnabled())
@@ -515,7 +515,9 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
                         else
                             v = o;
 
-                        vis.apply(k, v, ver);
+                        KeyCacheObject cacheKey = cctx.toCacheKeyObject(k);
+
+                        vis.apply(cacheKey, v, ver);
                     }
                 }, args);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
index c07f083..b3e085d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
@@ -55,7 +55,7 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
     private ByteBuffer valBytes;
 
     /** Value. */
-    private V val;
+    private CacheObject val;
 
     /** Falg indicating that value is byte array, so valBytes should not be unmarshalled. */
     private boolean valIsByteArr;
@@ -195,16 +195,17 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
     }
 
     /** {@inheritDoc} */
-    @Override public V value() {
+    @Override public CacheObject value() {
         return val;
     }
 
     /** {@inheritDoc} */
-    @Override public void value(V val) {
+    @Override public void value(CacheObject val) {
         this.val = val;
 
-        if (val instanceof byte[])
-            valBytes = null;
+// TODO IGNITE-51.
+//        if (val instanceof byte[])
+//            valBytes = null;
     }
 
     /** {@inheritDoc} */
@@ -294,7 +295,7 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
      * @param arr Entry bytes.
      * @return Entry.
      */
-    public static <T> GridCacheSwapEntryImpl<T> unmarshal(byte[] arr) {
+    public static GridCacheSwapEntryImpl unmarshal(byte[] arr) {
         long off = BYTE_ARR_OFF;
 
         long ttl = UNSAFE.getLong(arr, off);
@@ -329,7 +330,7 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
 
         IgniteUuid keyClsLdrId = U.readGridUuid(arr, off);
 
-        return new GridCacheSwapEntryImpl<T>(ByteBuffer.wrap(valBytes),
+        return new GridCacheSwapEntryImpl(ByteBuffer.wrap(valBytes),
             valIsByteArr,
             ver,
             ttl,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbc8ed32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java
index d624cd8..5a707c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java
@@ -20,12 +20,12 @@ package org.apache.ignite.internal.processors.cache;
 /**
  * Provides ability to listen to swap events in cache which is necessary for preloading.
  */
-public interface GridCacheSwapListener<K, V> {
+public interface GridCacheSwapListener {
     /**
      * @param part Partition.
      * @param key Cache key.
      * @param keyBytes Key bytes.
      * @param e Entry.
      */
-    public void onEntryUnswapped(int part, K key, byte[] keyBytes, GridCacheSwapEntry<V> e);
+    public void onEntryUnswapped(int part, KeyCacheObject key, byte[] keyBytes, GridCacheSwapEntry e);
 }


Mime
View raw message