ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [13/18] incubator-ignite git commit: # ignite-51
Date Wed, 04 Mar 2015 21:14:36 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/affinity/GridCacheAffinityImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/affinity/GridCacheAffinityImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/affinity/GridCacheAffinityImpl.java
index 3b2d073..4b381fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/affinity/GridCacheAffinityImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/affinity/GridCacheAffinityImpl.java
@@ -147,14 +147,8 @@ public class GridCacheAffinityImpl<K, V> implements CacheAffinity<K> {
     @Override public Object affinityKey(K key) {
         A.notNull(key, "key");
 
-        if (cctx.portableEnabled()) {
-            try {
-                key = (K)cctx.marshalToPortable(key);
-            }
-            catch (IgniteException e) {
-                U.error(log, "Failed to marshal key to portable: " + key, e);
-            }
-        }
+        if (key instanceof CacheObject)
+            key = ((CacheObject)key).value(cctx.cacheObjectContext(), false);
 
         return cctx.config().getAffinityMapper().affinityKey(key);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
index ba4d44c..8ca8689 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
@@ -247,7 +247,7 @@ public class CacheDataStructuresManager<K, V> extends GridCacheManagerAdapter<K,
      * @param rmv {@code True} if entry was removed.
      */
     public void onEntryUpdated(KeyCacheObject key, boolean rmv) {
-        Object key0 = key.value(cctx, false);
+        Object key0 = key.value(cctx.cacheObjectContext(), false);
 
         if (key0 instanceof GridCacheSetItemKey)
             onSetItemUpdated((GridCacheSetItemKey)key0, rmv);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index dfdda3a..6136e5f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -438,7 +438,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
         long topVer,
         boolean replicate,
         @Nullable ExpiryPolicy plc) {
-        if (p != null && !p.apply(key.<K>value(ctx, false), (V)val))
+        if (p != null && !p.apply(key.<K>value(ctx.cacheObjectContext(), false), (V)val))
             return;
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index fb4e0e1..4740e10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -318,7 +318,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
                             Object procRes = null;
                             Exception err = null;
 
-                            Object keyVal = key.value(cacheCtx, false);
+                            Object keyVal = key.value(cacheCtx.cacheObjectContext(), false);
                             Object val0 = CU.value(val, cacheCtx, false);
 
                             for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
@@ -340,7 +340,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
                             }
 
                             if (err != null || procRes != null)
-                                ret.addEntryProcessResult(key.value(cacheCtx, false),
+                                ret.addEntryProcessResult(key.value(cacheCtx.cacheObjectContext(), false),
                                     err == null ? new CacheInvokeResult<>(procRes) : new CacheInvokeResult<>(err));
                             else
                                 ret.invokeResult(true);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 103f3a7..ef5e7cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1323,7 +1323,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                         taskName,
                         null);
 
-                    Object keyVal = entry.key().value(ctx, false);
+                    Object keyVal = entry.key().value(ctx.cacheObjectContext(), false);
                     Object oldVal = CU.value(old, ctx, false);
                     Object updatedVal = null;
 
@@ -1464,9 +1464,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             taskName,
                             null);
 
-                        Object val = ctx.config().getInterceptor().onBeforePut(entry.key().value(ctx, false),
+                        Object val = ctx.config().getInterceptor().onBeforePut(
+                            entry.key().value(ctx.cacheObjectContext(), false),
                             CU.value(old, ctx, false),
-                            updated.value(ctx, false));
+                            updated.value(ctx.cacheObjectContext(), false));
 
                         if (val == null)
                             continue;
@@ -1500,7 +1501,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             null);
 
                         IgniteBiTuple<Boolean, ?> interceptorRes = ctx.config().getInterceptor().onBeforeRemove(
-                            entry.key().value(ctx, false),
+                            entry.key().value(ctx.cacheObjectContext(), false),
                             CU.value(old, ctx, false));
 
                         if (ctx.cancelRemove(interceptorRes))
@@ -1970,14 +1971,15 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     if (intercept) {
                         if (op == UPDATE) {
                             ctx.config().getInterceptor().onAfterPut(
-                                entry.key().value(ctx, false),
+                                entry.key().value(ctx.cacheObjectContext(), false),
                                 CU.value(updRes.newValue(), ctx, false));
                         }
                         else {
                             assert op == DELETE : op;
 
                             // Old value should be already loaded for 'CacheInterceptor.onBeforeRemove'.
-                            ctx.config().getInterceptor().onAfterRemove(entry.key().value(ctx, false),
+                            ctx.config().getInterceptor().onAfterRemove(
+                                entry.key().value(ctx.cacheObjectContext(), false),
                                 CU.value(updRes.oldValue(), ctx, false));
                         }
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index e1d6afb..45e9455 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -901,7 +901,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
                 CacheInvokeResult<?> res0 = res.error() == null ?
                     new CacheInvokeResult<>(CU.value(res.result(), cctx, false)) : new CacheInvokeResult<>(res.error());
 
-                map0.put(res.key().value(cctx, false), res0);
+                map0.put(res.key().value(cctx.cacheObjectContext(), false), res0);
             }
 
             if (opRes != null) {
@@ -933,7 +933,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object> implem
         List<Object> keys = new ArrayList<>(failedKeys.size());
 
         for (KeyCacheObject key : failedKeys)
-            keys.add(key.value(cctx, false));
+            keys.add(key.value(cctx.cacheObjectContext(), false));
 
         err0.add(keys, err);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 5f8038a..5dfc075 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -420,7 +420,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
         finishUnmarshalCacheObjects(nearVals, cctx, ldr);
 
         if (retVal != null)
-            retVal.finishUnmarshal(cctx, ldr);
+            retVal.finishUnmarshal(cctx.cacheObjectContext(), ldr);
 
         if (invokeRes != null) {
             for (CacheInvokeDirectResult res : invokeRes)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
new file mode 100644
index 0000000..08b43e0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/CacheVersionedValue.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+
+import java.nio.*;
+
+/**
+ * Cache object and version.
+ */
+public class CacheVersionedValue implements Message {
+    /** Cache version. */
+    private GridCacheVersion vers;
+
+    /** Cache object. */
+    private CacheObject obj;
+
+    /** */
+    public CacheVersionedValue() {
+        // No-op.
+    }
+
+    /**
+     * @param vers Cache version.
+     * @param obj Cache object.
+     */
+    CacheVersionedValue(GridCacheVersion vers, CacheObject obj) {
+        this.vers = vers;
+        this.obj = obj;
+    }
+
+    /**
+     * @return Cache version.
+     */
+    public GridCacheVersion version() {
+        return vers;
+    }
+
+    /**
+     * @return Cache object.
+     */
+    public CacheObject cacheObject() {
+        return obj;
+    }
+
+    /**
+     * This method is called before the whole message is sent
+     * and is responsible for pre-marshalling state.
+     *
+     * @param ctx Cache object context.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+        if (obj != null)
+            obj.prepareMarshal(ctx);
+    }
+
+    /**
+     * This method is called after the whole message is recived
+     * and is responsible for unmarshalling state.
+     *
+     * @param ctx Context.
+     * @param ldr Class loader.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+        if (obj != null)
+            obj.finishUnmarshal(ctx.cacheObjectContext(), ldr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 0:
+                if (!writer.writeMessage("obj", obj))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if (!writer.writeMessage("vers", vers))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        switch (reader.state()) {
+            case 0:
+                obj = reader.readMessage("obj");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 1:
+                vers = reader.readMessage("vers");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return 102;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
index d06ca5b..b5cbe69 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -315,7 +315,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
             taskName,
             true,
             null,
-            false).get().get(key.value(cctx, false));
+            false).get().get(key.value(cctx.cacheObjectContext(), false));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 31481f2..b26c1ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -490,8 +490,8 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
                 }
 
                 if (v != null && !reload) {
-                    K key0 = key.value(cctx, false);
-                    V val0 = v.value(cctx, true);
+                    K key0 = key.value(cctx.cacheObjectContext(), false);
+                    V val0 = v.value(cctx.cacheObjectContext(), true);
 
                     if (cctx.portableEnabled()) {
                         val0 = (V)cctx.unwrapPortableIfNeeded(val0, !deserializePortable);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 6b16aa4..8057922 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -302,7 +302,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
                         // Must loop through keys, not map entries,
                         // as map entries may not have all the keys.
                         for (KeyCacheObject key : keys)
-                            c.apply(key, map.get(key.value(cacheCtx, false)));
+                            c.apply(key, map.get(key.value(cacheCtx.cacheObjectContext(), false)));
 
                         return true;
                     }
@@ -332,7 +332,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
                             // Must loop through keys, not map entries,
                             // as map entries may not have all the keys.
                             for (KeyCacheObject key : keys)
-                                c.apply(key, map.get(key.value(cacheCtx, false)));
+                                c.apply(key, map.get(key.value(cacheCtx.cacheObjectContext(), false)));
 
                             return true;
                         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 2a6cddb..557331c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -934,7 +934,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
                 else {
                     assert F.isEmpty(res.invalidPartitions());
 
-                    for (Map.Entry<IgniteTxKey, NearTxPrepareResponseOwnedValue> entry : res.ownedValues().entrySet()) {
+                    for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : res.ownedValues().entrySet()) {
                         IgniteTxEntry txEntry = tx.entry(entry.getKey());
 
                         assert txEntry != null;
@@ -946,7 +946,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
                                 if (cacheCtx.isNear()) {
                                     GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
 
-                                    NearTxPrepareResponseOwnedValue tup = entry.getValue();
+                                    CacheVersionedValue tup = entry.getValue();
 
                                     nearEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion(),
                                         tup.version(), m.node().id());
@@ -954,7 +954,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
                                 else if (txEntry.cached().detached()) {
                                     GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
 
-                                    NearTxPrepareResponseOwnedValue tup = entry.getValue();
+                                    CacheVersionedValue tup = entry.getValue();
 
                                     detachedEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion());
                                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
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 6cf80ef..f88d363 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
@@ -61,7 +61,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
     /** Map of owned values to set on near node. */
     @GridToStringInclude
     @GridDirectTransient
-    private Map<IgniteTxKey, NearTxPrepareResponseOwnedValue> ownedVals;
+    private Map<IgniteTxKey, CacheVersionedValue> ownedVals;
 
     /** OwnedVals' keys for marshalling. */
     @GridToStringExclude
@@ -70,8 +70,8 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
 
     /** OwnedVals' values for marshalling. */
     @GridToStringExclude
-    @GridDirectCollection(NearTxPrepareResponseOwnedValue.class)
-    private Collection<NearTxPrepareResponseOwnedValue> ownedValVals;
+    @GridDirectCollection(CacheVersionedValue.class)
+    private Collection<CacheVersionedValue> ownedValVals;
 
     /** Cache return value. */
     @GridDirectTransient
@@ -174,7 +174,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
         if (ownedVals == null)
             ownedVals = new HashMap<>();
 
-        NearTxPrepareResponseOwnedValue oVal = new NearTxPrepareResponseOwnedValue(ver, val);
+        CacheVersionedValue oVal = new CacheVersionedValue(ver, val);
 
         ownedVals.put(key, oVal);
     }
@@ -182,9 +182,9 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
     /**
      * @return Owned values map.
      */
-    public Map<IgniteTxKey, NearTxPrepareResponseOwnedValue> ownedValues() {
+    public Map<IgniteTxKey, CacheVersionedValue> ownedValues() {
         return ownedVals == null ?
-            Collections.<IgniteTxKey, NearTxPrepareResponseOwnedValue>emptyMap() :
+            Collections.<IgniteTxKey, CacheVersionedValue>emptyMap() :
             Collections.unmodifiableMap(ownedVals);
     }
 
@@ -234,7 +234,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
 
             ownedValVals = ownedVals.values();
 
-            for (Map.Entry<IgniteTxKey, NearTxPrepareResponseOwnedValue> entry : ownedVals.entrySet()) {
+            for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : ownedVals.entrySet()) {
                 GridCacheContext cacheCtx = ctx.cacheContext(entry.getKey().cacheId());
 
                 entry.getKey().prepareMarshal(cacheCtx);
@@ -266,14 +266,14 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
 
             Iterator<IgniteTxKey> keyIter = ownedValKeys.iterator();
 
-            Iterator<NearTxPrepareResponseOwnedValue> valueIter = ownedValVals.iterator();
+            Iterator<CacheVersionedValue> valueIter = ownedValVals.iterator();
 
             while (keyIter.hasNext()) {
                 IgniteTxKey key = keyIter.next();
 
                 GridCacheContext cctx = ctx.cacheContext(key.cacheId());
 
-                NearTxPrepareResponseOwnedValue value = valueIter.next();
+                CacheVersionedValue value = valueIter.next();
 
                 key.finishUnmarshal(cctx, ldr);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
deleted file mode 100644
index 87f936e..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.plugin.extensions.communication.*;
-
-import java.nio.*;
-
-/**
- * Message for owned values to set on near node.
- */
-public class NearTxPrepareResponseOwnedValue implements Message {
-    /** Cache version. */
-    private GridCacheVersion vers;
-
-    /** Cache object. */
-    private CacheObject obj;
-
-    /** */
-    public NearTxPrepareResponseOwnedValue() {
-        // No-op.
-    }
-
-    /**
-     * @param vers Cache version.
-     * @param obj Cache object.
-     */
-    NearTxPrepareResponseOwnedValue(GridCacheVersion vers, CacheObject obj) {
-        this.vers = vers;
-        this.obj = obj;
-    }
-
-    /**
-     * @return Cache version.
-     */
-    public GridCacheVersion version() {
-        return vers;
-    }
-
-    /**
-     * @return Cache object.
-     */
-    public CacheObject cacheObject() {
-        return obj;
-    }
-
-    /**
-     * This method is called before the whole message is sent
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache object context.
-     * @throws org.apache.ignite.IgniteCheckedException If failed.
-     */
-    public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
-        if (obj != null)
-            obj.prepareMarshal(ctx);
-    }
-
-    /**
-     * This method is called after the whole message is recived
-     * and is responsible for unmarshalling state.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws org.apache.ignite.IgniteCheckedException If failed.
-     */
-    public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        if (obj != null)
-            obj.finishUnmarshal(ctx, ldr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeMessage("obj", obj))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
-                if (!writer.writeMessage("vers", vers))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        switch (reader.state()) {
-            case 0:
-                obj = reader.readMessage("obj");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                vers = reader.readMessage("vers");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 102;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index f0a17f2..cffe3c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -1138,7 +1138,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
                             taskName,
                             null);
 
-                        Object keyVal = entry.key().value(ctx, false);
+                        Object keyVal = entry.key().value(ctx.cacheObjectContext(), false);
                         Object oldVal = CU.value(old, ctx, false);
 
                         CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(ctx, keyVal, oldVal);
@@ -1250,7 +1250,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
                                 null);
 
                             Object interceptorVal = ctx.config().getInterceptor().onBeforePut(
-                                entry.key().value(ctx, false),
+                                entry.key().value(ctx.cacheObjectContext(), false),
                                 CU.value(old, ctx, false),
                                 val);
 
@@ -1283,7 +1283,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
                                 null);
 
                             IgniteBiTuple<Boolean, ?> interceptorRes = ctx.config().getInterceptor().onBeforeRemove(
-                                entry.key().value(ctx, false),
+                                entry.key().value(ctx.cacheObjectContext(), false),
                                 CU.value(old, ctx, false));
 
                             if (ctx.cancelRemove(interceptorRes))
@@ -1432,11 +1432,12 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
                 if (intercept) {
                     if (op == UPDATE) {
-                        ctx.config().getInterceptor().onAfterPut(entry.key().value(ctx, false),
-                            writeVal.value(ctx, false));
+                        ctx.config().getInterceptor().onAfterPut(entry.key().value(ctx.cacheObjectContext(), false),
+                            writeVal.value(ctx.cacheObjectContext(), false));
                     }
                     else
-                        ctx.config().getInterceptor().onAfterRemove(entry.key().value(ctx, false), t.get2());
+                        ctx.config().getInterceptor().onAfterRemove(entry.key().value(ctx.cacheObjectContext(), false),
+                            t.get2());
                 }
             }
             catch (GridCacheEntryRemovedException ignore) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 260cff1..2472867 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -2334,7 +2334,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                 if (key != null)
                     return key;
 
-                key = cctx.toCacheKeyObject(null, keyBytes(), false).value(cctx, false);
+                key = cctx.toCacheKeyObject(null, keyBytes(), false).value(cctx.cacheObjectContext(), false);
 
                 return key;
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
index 43aaec3..7a77dc6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
@@ -130,13 +130,13 @@ public class CacheContinuousQueryEntry implements GridCacheDeployable, Message {
      * @throws IgniteCheckedException In case of error.
      */
     void unmarshal(GridCacheContext cctx, @Nullable ClassLoader ldr) throws IgniteCheckedException {
-        key.finishUnmarshal(cctx, ldr);
+        key.finishUnmarshal(cctx.cacheObjectContext(), ldr);
 
         if (newVal != null)
-            newVal.finishUnmarshal(cctx, ldr);
+            newVal.finishUnmarshal(cctx.cacheObjectContext(), ldr);
 
         if (oldVal != null)
-            oldVal.finishUnmarshal(cctx, ldr);
+            oldVal.finishUnmarshal(cctx.cacheObjectContext(), ldr);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
index 1bdadaf..f24fc8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
@@ -56,7 +56,7 @@ class CacheContinuousQueryEvent<K, V> extends CacheEntryEvent<K, V> {
 
     /** {@inheritDoc} */
     @Override public K getKey() {
-        return e.key().value(cctx, false);
+        return e.key().value(cctx.cacheObjectContext(), false);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index c336d00..37f4494 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -167,11 +167,11 @@ public class CacheContinuousQueryManager<K, V> extends GridCacheManagerAdapter<K
                     oldVal = cctx.unwrapTemporary(oldVal);
 
                     if (oldVal != null)
-                        oldVal.finishUnmarshal(cctx, cctx.deploy().globalLoader());
+                        oldVal.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
                 }
 
                 if (newVal != null)
-                    newVal.finishUnmarshal(cctx, cctx.deploy().globalLoader());
+                    newVal.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
 
                 initialized = true;
             }
@@ -221,7 +221,7 @@ public class CacheContinuousQueryManager<K, V> extends GridCacheManagerAdapter<K
                         oldVal = cctx.unwrapTemporary(oldVal);
 
                     if (oldVal != null)
-                        oldVal.finishUnmarshal(cctx, cctx.deploy().globalLoader());
+                        oldVal.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
 
                     initialized = true;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 31a8d69..0e37349 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
@@ -1225,7 +1225,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
 
                 boolean modified = false;
 
-                Object key = txEntry.key().value(txEntry.context(), false);
+                Object key = txEntry.key().value(txEntry.context().cacheObjectContext(), false);
 
                 Object val = CU.value(cacheVal, txEntry.context(), false);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 87ab46b..323ba15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -738,7 +738,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
             }
         }
 
-        key.finishUnmarshal(context(), clsLdr);
+        key.finishUnmarshal(context().cacheObjectContext(), clsLdr);
 
         val.unmarshal(this.ctx, clsLdr);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
index eb0fee8..2237d63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java
@@ -84,7 +84,7 @@ public class IgniteTxKey implements Message {
     public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
         assert key != null;
 
-        key.finishUnmarshal(ctx, ldr);
+        key.finishUnmarshal(ctx.cacheObjectContext(), ldr);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 5651d0f..342ebd0 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
@@ -539,7 +539,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 Object oldVal = CU.value(e.cached().rawGetOrUnmarshal(true), cacheCtx, false);
 
                                 Object interceptorVal = cacheCtx.config().getInterceptor().onBeforePut(
-                                    key.value(cacheCtx, false),
+                                    key.value(cacheCtx.cacheObjectContext(), false),
                                     oldVal,
                                     CU.value(val, cacheCtx, false));
 
@@ -582,7 +582,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 Object oldVal = CU.value(e.cached().rawGetOrUnmarshal(true), cacheCtx, false);
 
                                 IgniteBiTuple<Boolean, Object> t = cacheCtx.config().getInterceptor()
-                                    .onBeforeRemove(key.value(cacheCtx, false), oldVal);
+                                    .onBeforeRemove(key.value(cacheCtx.cacheObjectContext(), false), oldVal);
 
                                 if (cacheCtx.cancelRemove(t))
                                     continue;
@@ -1647,7 +1647,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
                         // Load keys only after the locks have been acquired.
                         for (KeyCacheObject cacheKey : lockKeys) {
-                            K keyVal = (K)(keepCacheObjects ? cacheKey : cacheKey.value(cacheCtx, false));
+                            K keyVal =
+                                (K)(keepCacheObjects ? cacheKey : cacheKey.value(cacheCtx.cacheObjectContext(), false));
 
                             if (retMap.containsKey(keyVal))
                                 // We already have a return value.
@@ -1790,7 +1791,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                         for (Iterator<KeyCacheObject> it = missed.keySet().iterator(); it.hasNext(); ) {
                             KeyCacheObject cacheKey = it.next();
 
-                            K keyVal = (K)(keepCacheObjects ? cacheKey : cacheKey.value(cacheCtx, false));
+                            K keyVal =
+                                (K)(keepCacheObjects ? cacheKey : cacheKey.value(cacheCtx.cacheObjectContext(), false));
 
                             if (retMap.containsKey(keyVal))
                                 it.remove();
@@ -2463,7 +2465,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
     private void addInvokeResult(IgniteTxEntry txEntry, CacheObject cacheVal, GridCacheReturn<?> ret) {
         GridCacheContext ctx = txEntry.context();
 
-        Object keyVal = txEntry.key().value(ctx, false);
+        Object keyVal = txEntry.key().value(ctx.cacheObjectContext(), false);
         Object val = CU.value(cacheVal, ctx, false);
 
         try {
@@ -2598,21 +2600,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                 // Loose all skipped.
                 final Set<KeyCacheObject> loaded = loadFut.get();
 
-                final Collection<KeyCacheObject> keys;
-
-                if (keySet != null ) {
-                    keys = new ArrayList<>(keySet.size());
-
-                    // TODO IGNITE-51.
-                    for (K k : keySet) {
-                        KeyCacheObject cacheKey = cacheCtx.toCacheKeyObject(k);
-
-                        if (k != null && (loaded == null || !loaded.contains(cacheKey)))
-                            keys.add(cacheKey);
-                    }
-                }
-                else
-                    keys = Collections.emptyList();
+                final Collection<KeyCacheObject> keys = F.view(enlisted, F0.notIn(loaded));
 
                 if (log.isDebugEnabled())
                     log.debug("Before acquiring transaction lock for put on keys: " + keys);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index cce97b1..b6b724f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -137,7 +137,7 @@ public class TxEntryValueHolder implements Message {
      */
     public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
         if (hasWriteVal && val != null)
-            val.finishUnmarshal(ctx, ldr);
+            val.finishUnmarshal(ctx.cacheObjectContext(), ldr);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadUpdateJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadUpdateJob.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadUpdateJob.java
index c19d9e6..7d46e23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadUpdateJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadUpdateJob.java
@@ -109,12 +109,12 @@ class GridDataLoadUpdateJob implements GridPlainCallable<Object> {
             final GridCacheContext cctx = cache.context();
 
             for (IgniteDataLoaderEntry e : col) {
-                e.getKey().finishUnmarshal(cctx, cctx.deploy().globalLoader());
+                e.getKey().finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
 
                 CacheObject val = e.getValue();
 
                 if (val != null)
-                    val.finishUnmarshal(cctx, cctx.deploy().globalLoader());
+                    val.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
             }
 
             if (unwrapEntries()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderEntry.java
index b6efc9f..89bebe4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderEntry.java
@@ -79,7 +79,7 @@ public class IgniteDataLoaderEntry implements Map.Entry<KeyCacheObject, CacheObj
     public <K, V> Map.Entry<K, V> toEntry(final GridCacheContext ctx) {
         return new Map.Entry<K, V>() {
             @Override public K getKey() {
-                return key.value(ctx, false);
+                return key.value(ctx.cacheObjectContext(), false);
             }
 
             @Override public V setValue(V val) {
@@ -87,7 +87,7 @@ public class IgniteDataLoaderEntry implements Map.Entry<KeyCacheObject, CacheObj
             }
 
             @Override public V getValue() {
-                return val != null ? val.<V>value(ctx, false) : null;
+                return val != null ? val.<V>value(ctx.cacheObjectContext(), false) : null;
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
index 35a79be..b6ec07e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
@@ -446,9 +446,12 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
 
             return new IgniteFutureImpl<>(resFut);
         }
-        catch (IgniteException e) {
+        catch (Throwable e) {
             resFut.onDone(e);
 
+            if (e instanceof Error)
+                throw e;
+
             return new IgniteFinishedFutureImpl<>(ctx, e);
         }
         finally {
@@ -505,8 +508,8 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
                 assert key != null;
 
                 if (initPda) {
-                    jobPda = new DataLoaderPda(key.value(null, false),
-                        CU.value(entry.getValue(), null, false),
+                    jobPda = new DataLoaderPda(key.value(cacheObjCtx, false),
+                        entry.getValue() != null ? entry.getValue().value(cacheObjCtx, false) : null,
                         updater);
 
                     initPda = false;
@@ -1343,7 +1346,7 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
 
             for (Map.Entry<KeyCacheObject, CacheObject> e : entries) {
                 try {
-                    e.getKey().finishUnmarshal(cctx, cctx.deploy().globalLoader());
+                    e.getKey().finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
 
                     GridCacheEntryEx entry = internalCache.entryEx(e.getKey(), topVer);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 91c69ff..6befea6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -1005,7 +1005,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
             for (IgniteTxEntry entry : entries) {
                 // Check updated or created GridCacheInternalKey keys.
                 if ((entry.op() == CREATE || entry.op() == UPDATE) && entry.key().internal()) {
-                    GridCacheInternal key = entry.key().value(entry.context(), false);
+                    GridCacheInternal key = entry.key().value(entry.context().cacheObjectContext(), false);
 
                     Object val0 = CU.value(entry.value(), entry.context(), false);
 
@@ -1038,7 +1038,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
                 // Check deleted GridCacheInternal keys.
                 if (entry.op() == DELETE && entry.key().internal()) {
-                    GridCacheInternal key = entry.key().value(entry.context(), false);
+                    GridCacheInternal key = entry.key().value(entry.context().cacheObjectContext(), false);
 
                     // Entry's val is null if entry deleted.
                     GridCacheRemovable obj = dsMap.remove(key);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
index bca8127..9500571 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
@@ -20,10 +20,12 @@ package org.apache.ignite.internal.processors.portable;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
@@ -75,7 +77,7 @@ public abstract class IgniteCacheObjectProcessorAdapter extends GridProcessorAda
         if (obj == null)
             return null;
 
-        return obj.prepareForCache(cctx);
+        return obj.prepareForCache(cctx.cacheObjectContext());
     }
 
     /** {@inheritDoc} */
@@ -140,7 +142,20 @@ public abstract class IgniteCacheObjectProcessorAdapter extends GridProcessorAda
 
     /** {@inheritDoc} */
     @Override public CacheObjectContext contextForCache(ClusterNode node, @Nullable String cacheName) {
-        return new CacheObjectContext(ctx);
+        CacheConfiguration ccfg = null;
+
+        for (CacheConfiguration ccfg0 : ctx.config().getCacheConfiguration()) {
+            if (F.eq(cacheName, ccfg0.getName())) {
+                ccfg = ccfg0;
+
+                break;
+            }
+        }
+
+        return new CacheObjectContext(ctx,
+            new GridCacheDefaultAffinityKeyMapper(),
+            ccfg != null && ccfg.isCopyOnGet(),
+            ccfg != null && ccfg.isQueryIndexEnabled());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index be78585..b8b67cd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -3439,7 +3439,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             locKeys.addAll(cache.keySet(new CacheEntryPredicateAdapter() {
                 @Override public boolean apply(GridCacheEntryEx e) {
-                    return grid(0).affinity(null).isBackup(grid(0).localNode(), e.key().value(e.context(), false));
+                    return grid(0).affinity(null).isBackup(grid(0).localNode(),
+                        e.key().value(e.context().cacheObjectContext(), false));
                 }
             }));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
index fdc7e81..ad2a4d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
@@ -577,7 +577,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest {
             CacheValue val = CU.value(entry.rawGet(), entry.context(), false);
 
             assertNotNull("Value null for key: " + i, val);
-            assertEquals(entry.key().value(entry.context(), false), (Integer)val.value());
+            assertEquals(entry.key().value(entry.context().cacheObjectContext(), false), (Integer)val.value());
 
             assertEquals(entry.version(), versions.get(i));
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
index 8b240f5..ecfa7f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
@@ -357,7 +357,7 @@ public abstract class GridCacheAbstractQueueFailoverDataConsistencySelfTest exte
 
         for (int i = 0; i < gridCount(); i++) {
             for (GridCacheEntryEx e : ((IgniteKernal)grid(i)).context().cache().internalCache(cctx.name()).map().allEntries0()) {
-                if (aff.primary(grid(i).localNode(), e.key(), -1) && e.key().value(cctx, false) instanceof GridCacheQueueHeaderKey)
+                if (aff.primary(grid(i).localNode(), e.key(), -1) && e.key().value(cctx.cacheObjectContext(), false) instanceof GridCacheQueueHeaderKey)
                     return i;
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
index 7f73726..ec5fc5b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
@@ -270,7 +270,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
 
         assertNotNull(dhtEntry);
 
-        assertEquals(Integer.valueOf(0), dhtEntry.rawGet().value(dhtEntry.context(), false));
+        assertEquals(Integer.valueOf(0), dhtEntry.rawGet().value(dhtEntry.context().cacheObjectContext(), false));
 
         final AtomicInteger globalCntr = new AtomicInteger(0);
 
@@ -560,7 +560,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
 
         assertNotNull(dhtEntry);
 
-        assertEquals(Integer.valueOf(0), dhtEntry.rawGet().value(dhtEntry.context(), false));
+        assertEquals(Integer.valueOf(0), dhtEntry.rawGet().value(dhtEntry.context().cacheObjectContext(), false));
 
         startLatchMultiNode = new CountDownLatch(gridCnt);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 3002673..d98da6c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -2086,10 +2086,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             if (cctx.isNear())
                 cctx = cctx.near().dht().context();
 
-            // TODO IGNITE-51.
             GridCacheSwapEntry e = cctx.swap().read(cctx.toCacheKeyObject(key), true, true);
 
-            return e != null ? e.value().value(cctx, false) : null;
+            return e != null ? e.value().value(cctx.cacheObjectContext(), false) : null;
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
index 28f7ce0..952651a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
@@ -271,10 +271,10 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest {
             assert entry != null;
             assert entry.key() != null;
 
-            Long val = entry.rawGet().value(entry.context(), false);
+            Long val = entry.rawGet().value(entry.context().cacheObjectContext(), false);
 
             assertNotNull("Value null for key: " + i, val);
-            assertEquals(entry.key().value(entry.context(), false), val);
+            assertEquals(entry.key().value(entry.context().cacheObjectContext(), false), val);
             assertEquals(entry.version(), versions.get(i));
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b876320e/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringDynamicCacheManager.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringDynamicCacheManager.java b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringDynamicCacheManager.java
index 0a538a0..f5af8b8 100644
--- a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringDynamicCacheManager.java
+++ b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringDynamicCacheManager.java
@@ -316,7 +316,7 @@ public class SpringDynamicCacheManager extends SpringCacheManager {
 
         /** {@inheritDoc} */
         @Override public boolean apply(GridCacheEntryEx e) {
-            DataKey key = e.key().value(e.context(), false);
+            DataKey key = e.key().value(e.context().cacheObjectContext(), false);
 
             return name != null ? name.equals(key.name) : key.name == null;
         }


Mime
View raw message