ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/4] incubator-ignite git commit: # ignite-51-filters
Date Tue, 03 Mar 2015 15:53:29 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-51-filters [created] 6febd89af


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
index 4e769e4..8a8fb5c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java
@@ -82,7 +82,7 @@ public final class GridLocalLockFuture<K, V> extends GridFutureAdapter<Boolean>
     private IgniteLogger log;
 
     /** Filter. */
-    private IgnitePredicate<Cache.Entry<K, V>>[] filter;
+    private CacheEntryPredicate[] filter;
 
     /** Transaction. */
     private IgniteTxLocalEx tx;
@@ -111,7 +111,7 @@ public final class GridLocalLockFuture<K, V> extends GridFutureAdapter<Boolean>
         IgniteTxLocalEx tx,
         GridLocalCache<K, V> cache,
         long timeout,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+        CacheEntryPredicate[] filter) {
         super(cctx.kernalContext());
 
         assert keys != null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 588d987..a4a586f 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
@@ -110,7 +110,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         V val,
         @Nullable GridCacheEntryEx cached,
         long ttl,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) throws IgniteCheckedException {
+        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
         A.notNull(key, "key", val, "val");
 
         ctx.denyOnLocalRead();
@@ -132,7 +132,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         V val,
         @Nullable GridCacheEntryEx cached,
         long ttl,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
+        @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException {
         A.notNull(key, "key", val, "val");
 
         ctx.denyOnLocalRead();
@@ -151,7 +151,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @Override public boolean putx(K key,
         V val,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter) throws IgniteCheckedException {
+        CacheEntryPredicate[] filter) throws IgniteCheckedException {
         A.notNull(key, "key", val, "val");
 
         ctx.denyOnLocalRead();
@@ -173,7 +173,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         V val,
         @Nullable GridCacheEntryEx entry,
         long ttl,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
+        @Nullable CacheEntryPredicate... filter) {
         A.notNull(key, "key", val, "val");
 
         ctx.denyOnLocalRead();
@@ -192,7 +192,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         V val,
         @Nullable GridCacheEntryEx entry,
         long ttl,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
+        @Nullable CacheEntryPredicate... filter) {
         A.notNull(key, "key", val, "val");
 
         ctx.denyOnLocalRead();
@@ -208,61 +208,55 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public V putIfAbsent(K key, V val) throws IgniteCheckedException {
-        return put(key, val, ctx.<K, V>noPeekArray());
+        return put(key, val, ctx.noValArray());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<V> putIfAbsentAsync(K key, V val) {
-        return putAsync(key, val, ctx.<K, V>noPeekArray());
+        return putAsync(key, val, ctx.noValArray());
     }
 
     /** {@inheritDoc} */
     @Override public boolean putxIfAbsent(K key, V val) throws IgniteCheckedException {
-        return putx(key, val, ctx.<K, V>noPeekArray());
+        return putx(key, val, ctx.noValArray());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> putxIfAbsentAsync(K key, V val) {
-        return putxAsync(key, val, ctx.<K, V>noPeekArray());
+        return putxAsync(key, val, ctx.noValArray());
     }
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public V replace(K key, V val) throws IgniteCheckedException {
-        return put(key, val, ctx.hasPeekArray());
+        return put(key, val, ctx.hasValArray());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<V> replaceAsync(K key, V val) {
-        return putAsync(key, val, ctx.hasPeekArray());
+        return putAsync(key, val, ctx.hasValArray());
     }
 
     /** {@inheritDoc} */
     @Override public boolean replacex(K key, V val) throws IgniteCheckedException {
-        return putx(key, val, ctx.hasPeekArray());
+        return putx(key, val, ctx.hasValArray());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> replacexAsync(K key, V val) {
-        return putxAsync(key, val, ctx.hasPeekArray());
+        return putxAsync(key, val, ctx.hasValArray());
     }
 
     /** {@inheritDoc} */
     @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException {
         A.notNull(oldVal, "oldVal");
 
-        if (ctx.portableEnabled())
-            oldVal = (V)ctx.marshalToPortable(oldVal);
-
-        return putx(key, newVal, ctx.equalsPeekArray(oldVal));
+        return putx(key, newVal, ctx.equalsValArray(oldVal));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) {
-        if (ctx.portableEnabled())
-            oldVal = (V)ctx.marshalToPortable(oldVal);
-
-        return putxAsync(key, newVal, ctx.equalsPeekArray(oldVal));
+        return putxAsync(key, newVal, ctx.equalsValArray(oldVal));
     }
 
     /** {@inheritDoc} */
@@ -272,9 +266,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
         ctx.denyOnLocalRead();
 
-        if (ctx.portableEnabled())
-            oldVal = (V)ctx.marshalToPortable(oldVal);
-
         return (GridCacheReturn<V>)updateAllInternal(UPDATE,
             Collections.singleton(key),
             Collections.singleton(newVal),
@@ -282,7 +273,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
             expiryPerCall(),
             true,
             true,
-            ctx.equalsPeekArray(oldVal),
+            ctx.equalsValArray(oldVal),
             ctx.writeThrough());
     }
 
@@ -293,9 +284,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
         ctx.denyOnLocalRead();
 
-        if (ctx.portableEnabled())
-            val = (V)ctx.marshalToPortable(val);
-
         return (GridCacheReturn<V>)updateAllInternal(DELETE,
             Collections.singleton(key),
             null,
@@ -303,7 +291,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
             expiryPerCall(),
             true,
             true,
-            ctx.equalsPeekArray(val),
+            ctx.equalsValArray(val),
             ctx.writeThrough());
     }
 
@@ -314,10 +302,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
         ctx.denyOnLocalRead();
 
-        if (ctx.portableEnabled())
-            val = (V)ctx.marshalToPortable(val);
-
-        return removeAllAsync0(F.asList(key), true, true, ctx.equalsPeekArray(val));
+        return removeAllAsync0(F.asList(key), true, true, ctx.equalsValArray(val));
     }
 
     /** {@inheritDoc} */
@@ -327,20 +312,17 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
         ctx.denyOnLocalRead();
 
-        if (ctx.portableEnabled())
-            oldVal = (V)ctx.marshalToPortable(oldVal);
-
         return updateAllAsync0(F.asMap(key, newVal),
             null,
             null,
             true,
             true,
-            ctx.equalsPeekArray(oldVal));
+            ctx.equalsValArray(oldVal));
     }
 
     /** {@inheritDoc} */
     @Override public void putAll(Map<? extends K, ? extends V> m,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter) throws IgniteCheckedException {
+        CacheEntryPredicate[] filter) throws IgniteCheckedException {
         ctx.denyOnLocalRead();
 
         updateAllInternal(UPDATE,
@@ -356,7 +338,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> putAllAsync(Map<? extends K, ? extends V> m,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+        @Nullable CacheEntryPredicate[] filter) {
         ctx.denyOnLocalRead();
 
         return updateAllAsync0(m,
@@ -371,7 +353,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @SuppressWarnings("unchecked")
     @Override public V remove(K key,
         @Nullable GridCacheEntryEx entry,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
+        @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException {
         ctx.denyOnLocalRead();
 
         return (V)updateAllInternal(DELETE,
@@ -389,7 +371,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @SuppressWarnings("unchecked")
     @Override public IgniteInternalFuture<V> removeAsync(K key,
         @Nullable GridCacheEntryEx entry,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
+        @Nullable CacheEntryPredicate... filter) {
         ctx.denyOnLocalRead();
 
         return removeAllAsync0(Collections.singletonList(key), true, false, filter);
@@ -398,7 +380,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public void removeAll(Collection<? extends K> keys,
-        IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
+        CacheEntryPredicate... filter) throws IgniteCheckedException {
         ctx.denyOnLocalRead();
 
         updateAllInternal(DELETE,
@@ -414,7 +396,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> removeAllAsync(Collection<? extends K> keys,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+        CacheEntryPredicate[] filter) {
         ctx.denyOnLocalRead();
 
         return removeAllAsync0(keys, false, false, filter);
@@ -424,7 +406,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @SuppressWarnings("unchecked")
     @Override public boolean removex(K key,
         @Nullable GridCacheEntryEx entry,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
+        @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException {
         boolean statsEnabled = ctx.config().isStatisticsEnabled();
 
         long start = statsEnabled ? System.nanoTime() : 0L;
@@ -453,7 +435,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @SuppressWarnings("unchecked")
     @Override public IgniteInternalFuture<Boolean> removexAsync(K key,
         @Nullable GridCacheEntryEx entry,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
+        @Nullable CacheEntryPredicate... filter) {
         A.notNull(key, "key");
 
         ctx.denyOnLocalRead();
@@ -467,9 +449,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
         ctx.denyOnLocalRead();
 
-        if (ctx.portableEnabled())
-            val = (V)ctx.marshalToPortable(val);
-
         return (Boolean)updateAllInternal(DELETE,
             Collections.singleton(key),
             null,
@@ -477,16 +456,13 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
             expiryPerCall(),
             false,
             false,
-            ctx.equalsPeekArray(val),
+            ctx.equalsValArray(val),
             ctx.writeThrough());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> removeAsync(K key, V val) {
-        if (ctx.portableEnabled())
-            val = (V)ctx.marshalToPortable(val);
-
-        return removexAsync(key, ctx.equalsPeekArray(val));
+        return removexAsync(key, ctx.equalsValArray(val));
     }
 
     /** {@inheritDoc} */
@@ -862,7 +838,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         @Nullable final Object[] invokeArgs,
         final boolean retval,
         final boolean rawRetval,
-        @Nullable final IgnitePredicate<Cache.Entry<K, V>>[] filter
+        @Nullable final CacheEntryPredicate[] filter
     ) {
         final GridCacheOperation op = invokeMap != null ? TRANSFORM : UPDATE;
 
@@ -903,7 +879,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         @Nullable final Collection<? extends K> keys,
         final boolean retval,
         final boolean rawRetval,
-        @Nullable final IgnitePredicate<Cache.Entry<K, V>>[] filter
+        @Nullable final CacheEntryPredicate[] filter
     ) {
         final boolean writeThrough = ctx.writeThrough();
 
@@ -956,7 +932,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         @Nullable ExpiryPolicy expiryPlc,
         boolean retval,
         boolean rawRetval,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter,
+        CacheEntryPredicate[] filter,
         boolean storeEnabled) throws IgniteCheckedException {
         if (keyCheck)
             validateCacheKeys(keys);
@@ -966,8 +942,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         else
             ctx.checkSecurity(GridSecurityPermission.CACHE_PUT);
 
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filter0 = (IgnitePredicate[])filter;
-
         String taskName = ctx.kernalContext().job().currentTaskName();
 
         GridCacheVersion ver = ctx.versions().next();
@@ -1024,7 +998,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
                         expiryPlc,
                         true,
                         true,
-                        filter0,
+                        filter,
                         intercept,
                         subjId,
                         taskName);
@@ -1107,7 +1081,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         @Nullable Object[] invokeArgs,
         @Nullable ExpiryPolicy expiryPlc,
         GridCacheVersion ver,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter,
+        @Nullable CacheEntryPredicate[] filter,
         UUID subjId,
         String taskName
     ) throws IgniteCheckedException {
@@ -1141,7 +1115,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
                 try {
                     try {
-                        if (!ctx.isAll(entry.<K, V>wrapFilterLocked(), filter)) {
+                        if (!ctx.isAll(entry, filter)) {
                             if (log.isDebugEnabled())
                                 log.debug("Entry did not pass the filter (will skip write) [entry=" + entry +
                                     ", filter=" + Arrays.toString(filter) + ']');
@@ -1563,7 +1537,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         TransactionIsolation isolation,
         boolean invalidate,
         long accessTtl,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+        CacheEntryPredicate[] filter) {
         return new GridFinishedFutureEx<>(new UnsupportedOperationException("Locks are not supported for " +
             "CacheAtomicityMode.ATOMIC mode (use CacheAtomicityMode.TRANSACTIONAL instead)"));
     }
@@ -1572,7 +1546,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @SuppressWarnings("unchecked")
     @Override public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection<? extends K> keys,
         long timeout,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) {
+        @Nullable CacheEntryPredicate... filter) {
         return new GridFinishedFutureEx<>(new UnsupportedOperationException("Locks are not supported for " +
             "CacheAtomicityMode.ATOMIC mode (use CacheAtomicityMode.TRANSACTIONAL instead)"));
     }
@@ -1580,7 +1554,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public void unlockAll(@Nullable Collection<? extends K> keys,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>... filter) throws IgniteCheckedException {
+        @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException {
         throw new UnsupportedOperationException("Locks are not supported for " +
             "CacheAtomicityMode.ATOMIC mode (use CacheAtomicityMode.TRANSACTIONAL instead)");
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
index f6b4819..afc969f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
@@ -23,6 +23,7 @@ import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -195,8 +196,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
      * @return Query info.
      */
     @Nullable private GridCacheQueryInfo distributedQueryInfo(UUID sndId, GridCacheQueryRequest req) {
-        IgnitePredicate<Cache.Entry<Object, Object>> prjPred = req.projectionFilter() == null ?
-            F.<Cache.Entry<Object, Object>>alwaysTrue() : req.projectionFilter();
+        CacheEntryPredicate prjPred = req.projectionFilter();
 
         IgniteReducer<Object, Object> rdc = req.reducer();
         IgniteClosure<Object, Object> trans = req.transformer();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
index 3d8efbf..f6816e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
@@ -112,8 +112,7 @@ public class GridCacheLocalQueryFuture<K, V, R> extends GridCacheQueryFutureAdap
         private GridCacheQueryInfo localQueryInfo() throws IgniteCheckedException {
             GridCacheQueryBean qry = query();
 
-            IgnitePredicate<Cache.Entry<Object, Object>> prjPred = qry.query().projectionFilter() == null ?
-                F.<Cache.Entry<Object, Object>>alwaysTrue() : qry.query().projectionFilter();
+            CacheEntryPredicate prjPred = qry.query().projectionFilter();
 
             Marshaller marsh = cctx.marshaller();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueriesImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueriesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueriesImpl.java
index cb8921e..2e9f88f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueriesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueriesImpl.java
@@ -233,8 +233,8 @@ public class GridCacheQueriesImpl<K, V> implements GridCacheQueriesEx<K, V>, Ext
      * @return Optional projection filter.
      */
     @SuppressWarnings("unchecked")
-    @Nullable private IgnitePredicate<Cache.Entry<Object, Object>> filter() {
-        return prj == null ? null : ((GridCacheProjectionImpl<Object, Object>)prj).predicate();
+    @Nullable private CacheEntryPredicate filter() {
+        return prj == null ? null : prj.predicate();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 0c81e5e..57d3a11 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -43,7 +43,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
     private final GridCacheContext<?, ?> cctx;
 
     /** */
-    private final IgnitePredicate<Cache.Entry<Object, Object>> prjPred;
+    private final CacheEntryPredicate prjPred;
 
     /** */
     private final GridCacheQueryType type;
@@ -105,7 +105,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
      */
     public GridCacheQueryAdapter(GridCacheContext<?, ?> cctx,
         GridCacheQueryType type,
-        @Nullable IgnitePredicate<Cache.Entry<Object, Object>> prjPred,
+        @Nullable CacheEntryPredicate prjPred,
         @Nullable String clsName,
         @Nullable String clause,
         @Nullable IgniteBiPredicate<Object, Object> filter,
@@ -148,7 +148,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
      * @param taskHash Task hash.
      */
     public GridCacheQueryAdapter(GridCacheContext<?, ?> cctx,
-        IgnitePredicate<Cache.Entry<Object, Object>> prjPred,
+        CacheEntryPredicate prjPred,
         GridCacheQueryType type,
         IgniteLogger log,
         int pageSize,
@@ -186,7 +186,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
     /**
      * @return cache projection filter.
      */
-    @Nullable public IgnitePredicate<Cache.Entry<Object, Object>> projectionFilter() {
+    @Nullable public CacheEntryPredicate projectionFilter() {
         return prjPred;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryInfo.java
index 52a4723..865d431 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryInfo.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.query;
 
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
@@ -32,7 +33,7 @@ class GridCacheQueryInfo {
     private boolean loc;
 
     /** */
-    private IgnitePredicate<Cache.Entry<Object, Object>> prjPred;
+    private CacheEntryPredicate prjPred;
 
     /** */
     private IgniteClosure<Object, Object> trans;
@@ -76,7 +77,7 @@ class GridCacheQueryInfo {
      */
     GridCacheQueryInfo(
         boolean loc,
-        IgnitePredicate<Cache.Entry<Object, Object>> prjPred,
+        CacheEntryPredicate prjPred,
         IgniteClosure<Object, Object> trans,
         IgniteReducer<Object, Object> rdc,
         GridCacheQueryAdapter<?> qry,
@@ -124,7 +125,7 @@ class GridCacheQueryInfo {
     /**
      * @return Projection predicate.
      */
-    IgnitePredicate<Cache.Entry<Object, Object>> projectionPredicate() {
+    CacheEntryPredicate projectionPredicate() {
         return prjPred;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 d1f6d0f..fa74020 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
@@ -734,15 +734,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     @SuppressWarnings({"unchecked"})
     private GridCloseableIterator<IgniteBiTuple<K, V>> scanIterator(final GridCacheQueryAdapter<?> qry)
         throws IgniteCheckedException {
-        IgnitePredicate<Cache.Entry<K, V>> filter = null;
-
-        if (qry.projectionFilter() != null) {
-            filter = new P1<Cache.Entry<K, V>>() {
-                @Override public boolean apply(Cache.Entry<K, V> e) {
-                    return qry.projectionFilter().apply((Cache.Entry<Object, Object>)e);
-                }
-            };
-        }
+        CacheEntryPredicate filter = qry.projectionFilter();
 
         CacheProjection<K, V> prj0 = filter != null ? cctx.cache().projection(filter) : cctx.cache();
 
@@ -899,7 +891,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
      */
     private GridIterator<IgniteBiTuple<K, V>> swapIterator(GridCacheQueryAdapter<?> qry)
         throws IgniteCheckedException {
-        IgnitePredicate<Cache.Entry<Object, Object>> prjPred = qry.projectionFilter();
+        CacheEntryPredicate prjPred = qry.projectionFilter();
 
         IgniteBiPredicate<K, V> filter = qry.scanFilter();
 
@@ -913,7 +905,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
      * @return Offheap iterator.
      */
     private GridIterator<IgniteBiTuple<K, V>> offheapIterator(GridCacheQueryAdapter<?> qry) {
-        IgnitePredicate<Cache.Entry<Object, Object>> prjPred = qry.projectionFilter();
+        CacheEntryPredicate prjPred = qry.projectionFilter();
 
         IgniteBiPredicate<K, V> filter = qry.scanFilter();
 
@@ -938,7 +930,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
      */
     private GridIteratorAdapter<IgniteBiTuple<K, V>> scanIterator(
         @Nullable final Iterator<Map.Entry<byte[], byte[]>> it,
-        @Nullable final IgnitePredicate<Cache.Entry<Object, Object>> prjPred,
+        @Nullable final CacheEntryPredicate prjPred,
         @Nullable final IgniteBiPredicate<K, V> filter,
         final boolean keepPortable) {
         if (it == null)
@@ -979,8 +971,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                     if (prjPred != null) {
                         Cache.Entry<K, V> Entry = new GridCacheScanSwapEntry(e);
 
-                        if (!prjPred.apply((Cache.Entry<Object, Object>)Entry))
-                            continue;
+// TODO IGNITE-51.
+//                        if (!prjPred.apply((Cache.Entry<Object, Object>)Entry))
+//                            continue;
                     }
 
                     if (filter != null) {
@@ -1043,7 +1036,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
             try {
                 // Preparing query closures.
-                IgnitePredicate<Cache.Entry<Object, Object>> prjFilter = qryInfo.projectionPredicate();
+                CacheEntryPredicate prjFilter = qryInfo.projectionPredicate();
                 IgniteClosure<Object, Object> trans = (IgniteClosure<Object, Object>)qryInfo.transformer();
                 IgniteReducer<Object, Object> rdc = (IgniteReducer<Object, Object>)qryInfo.reducer();
 
@@ -1220,7 +1213,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
             try {
                 // Preparing query closures.
-                IgnitePredicate<Cache.Entry<Object, Object>> prjFilter = qryInfo.projectionPredicate();
+                CacheEntryPredicate prjFilter = qryInfo.projectionPredicate();
                 IgniteClosure<Map.Entry<K, V>, Object> trans = (IgniteClosure<Map.Entry<K, V>, Object>)qryInfo.transformer();
                 IgniteReducer<Map.Entry<K, V>, Object> rdc = (IgniteReducer<Map.Entry<K, V>, Object>)qryInfo.reducer();
 
@@ -1820,7 +1813,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     @Nullable private IndexingQueryFilter projectionFilter(GridCacheQueryAdapter<?> qry) {
         assert qry != null;
 
-        final IgnitePredicate<Cache.Entry<Object, Object>> prjFilter = qry.projectionFilter();
+        final CacheEntryPredicate prjFilter = qry.projectionFilter();
 
         if (prjFilter == null || F.isAlwaysTrue(prjFilter))
             return null;
@@ -1833,9 +1826,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                 return new IgniteBiPredicate<K, V>() {
                     @Override public boolean apply(K k, V v) {
                         try {
-                            Cache.Entry<K, V> entry = context().cache().entry(k);
+                            GridCacheEntryEx entry = context().cache().peekEx(cctx.toCacheKeyObject(k));
 
-                            return entry != null && prjFilter.apply((Cache.Entry<Object, Object>)entry);
+                            return entry != null && prjFilter.apply(entry);
                         }
                         catch (GridDhtInvalidPartitionException ignore) {
                             return false;
@@ -2341,7 +2334,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                 if (key != null)
                     return key;
 
-                key = cctx.marshaller().unmarshal(keyBytes(), cctx.deploy().globalLoader());
+                key = cctx.toCacheKeyObject(null, keyBytes(), false).value(cctx, false);
 
                 return key;
             }
@@ -2502,7 +2495,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
         private static final long serialVersionUID = 7410163202728985912L;
 
         /** */
-        private IgnitePredicate<Cache.Entry<Object, Object>> prjPred;
+        private CacheEntryPredicate prjPred;
 
         /** */
         private IgniteBiPredicate<K, V> filter;
@@ -2516,7 +2509,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
          * @param keepPortable Keep portable flag.
          */
         private OffheapIteratorClosure(
-            @Nullable IgnitePredicate<Cache.Entry<Object, Object>> prjPred,
+            @Nullable CacheEntryPredicate prjPred,
             @Nullable IgniteBiPredicate<K, V> filter,
             boolean keepPortable) {
             assert prjPred != null || filter != null;
@@ -2535,8 +2528,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             if (prjPred != null) {
                 Cache.Entry<K, V> entry = new GridCacheScanSwapEntry(e);
 
-                if (!prjPred.apply((Cache.Entry<Object, Object>)entry))
-                    return null;
+// TODO IGNITE-51.
+//                if (!prjPred.apply((Cache.Entry<Object, Object>)entry))
+//                    return null;
             }
 
             if (filter != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index c15286e..c5f55d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@ -67,7 +67,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
 
     /** */
     @GridDirectTransient
-    private IgnitePredicate<Cache.Entry<Object, Object>> prjFilter;
+    private CacheEntryPredicate prjFilter;
 
     /** */
     private byte[] prjFilterBytes;
@@ -198,7 +198,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
         String clause,
         String clsName,
         IgniteBiPredicate<Object, Object> keyValFilter,
-        IgnitePredicate<Cache.Entry<Object, Object>> prjFilter,
+        CacheEntryPredicate prjFilter,
         IgniteReducer<Object, Object> rdc,
         IgniteClosure<Object, Object> trans,
         int pageSize,
@@ -373,7 +373,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
     }
 
     /** {@inheritDoc} */
-    public IgnitePredicate<Cache.Entry<Object, Object>> projectionFilter() {
+    public CacheEntryPredicate projectionFilter() {
         return prjFilter;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
index 6ba6c55..c072bfb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
@@ -501,7 +501,7 @@ public interface IgniteInternalTx extends AutoCloseable, GridTimeoutObject {
          GridCacheContext ctx,
          boolean failFast,
          KeyCacheObject key,
-         @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) throws GridCacheFilterFailedException;
+         @Nullable CacheEntryPredicate[] filter) throws GridCacheFilterFailedException;
 
     /**
      * @return Start version.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 1cd4521..31a8d69 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
@@ -1919,7 +1919,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
         @Nullable @Override public <K, V> GridTuple<CacheObject> peek(GridCacheContext ctx,
             boolean failFast,
             KeyCacheObject key,
-            @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+            @Nullable CacheEntryPredicate[] filter) {
             return null;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 db166fb..82376b2 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
@@ -103,7 +103,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
 
     /** Put filters. */
     @GridToStringInclude
-    private IgnitePredicate<Cache.Entry<Object, Object>>[] filters;
+    private CacheEntryPredicate[] filters;
 
     /** Flag indicating whether filters passed. Used for fast-commit transactions. */
     private boolean filtersPassed;
@@ -211,7 +211,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
         Object[] invokeArgs,
         long ttl,
         GridCacheEntryEx entry,
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filters,
+        CacheEntryPredicate[] filters,
         GridCacheVersion conflictVer) {
         assert ctx != null;
         assert tx != null;
@@ -637,14 +637,14 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
     /**
      * @return Put filters.
      */
-    public IgnitePredicate<Cache.Entry<Object, Object>>[] filters() {
+    public CacheEntryPredicate[] filters() {
         return filters;
     }
 
     /**
      * @param filters Put filters.
      */
-    public void filters(IgnitePredicate<Cache.Entry<Object, Object>>[] filters) {
+    public void filters(CacheEntryPredicate[] filters) {
         filterBytes = null;
 
         this.filters = filters;
@@ -732,7 +732,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
                 filters = ctx.marshaller().unmarshal(filterBytes, clsLdr);
 
                 if (filters == null)
-                    filters = CU.empty();
+                    filters = CU.empty0();
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 699e239..0f24ad6 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
@@ -323,7 +323,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         GridCacheContext cacheCtx,
         boolean failFast,
         KeyCacheObject key,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter
+        CacheEntryPredicate[] filter
     ) throws GridCacheFilterFailedException {
         IgniteTxEntry e = txMap == null ? null : txMap.get(cacheCtx.txKey(key));
 
@@ -331,7 +331,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
             // We should look at tx entry previous value. If this is a user peek then previous
             // value is the same as value. If this is a filter evaluation peek then previous value holds
             // value visible to filter while value contains value enlisted for write.
-            if (!F.isEmpty(filter) && !F.isAll(e.cached().<K, V>wrapLazyValue(), filter))
+            if (!F.isEmpty(filter) && !F.isAll(e.cached(), filter))
                 return e.hasPreviousValue() ? F.t(CU.<CacheObject>failed(failFast, e.previousValue())) : null;
 
             return e.hasPreviousValue() ? F.t(e.previousValue()) : null;
@@ -841,7 +841,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                                 false,
                                                 metrics,
                                                 topVer,
-                                                CU.empty(),
+                                                CU.empty0(),
                                                 DR_NONE,
                                                 txEntry.conflictExpireTime(),
                                                 null,
@@ -874,7 +874,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                                 false,
                                                 metrics,
                                                 topVer,
-                                                CU.empty(),
+                                                CU.empty0(),
                                                 DR_NONE,
                                                 null,
                                                 CU.subjectId(this, cctx),
@@ -1322,7 +1322,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 null,
                                 entry,
                                 expiryPlc,
-                                CU.empty(),
+                                CU.empty0(),
                                 false,
                                 -1L,
                                 -1L,
@@ -1638,7 +1638,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     isolation,
                     isInvalidate(),
                     accessTtl,
-                    CU.empty());
+                    CU.empty0());
 
                 PLC2<Map<K, V>> plc2 = new PLC2<Map<K, V>>() {
                     @Override public IgniteInternalFuture<Map<K, V>> postLock() throws IgniteCheckedException {
@@ -1871,7 +1871,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         boolean retval,
         @Nullable GridCacheEntryEx cached,
         long ttl,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter
+        CacheEntryPredicate[] filter
     ) {
         return (IgniteInternalFuture<GridCacheReturn<CacheObject>>)putAllAsync0(cacheCtx,
             map,
@@ -1932,7 +1932,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
      * @throws IgniteCheckedException If failed.
      */
     private <K, V> boolean filter(GridCacheEntryEx cached,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter) throws IgniteCheckedException {
+        CacheEntryPredicate[] filter) throws IgniteCheckedException {
         return pessimistic() || (optimistic() && implicit()) || cached.context().isAll(cached, filter);
     }
 
@@ -1967,7 +1967,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         @Nullable Object[] invokeArgs,
         boolean retval,
         boolean lockOnly,
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filter,
+        CacheEntryPredicate[] filter,
         final GridCacheReturn<CacheObject> ret,
         Collection<KeyCacheObject> enlisted,
         @Nullable Map<? extends K, GridCacheDrInfo<V>> drPutMap,
@@ -2117,7 +2117,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                         null,
                                         entry,
                                         null,
-                                        CU.empty(),
+                                        CU.empty0(),
                                         false,
                                         -1L,
                                         -1L,
@@ -2329,7 +2329,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         boolean retval,
         boolean read,
         long accessTtl,
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filter,
+        CacheEntryPredicate[] filter,
         boolean computeInvoke
     ) throws IgniteCheckedException {
         for (KeyCacheObject k : keys) {
@@ -2420,7 +2420,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
                         // Revert operation to previous. (if no - NOOP, so entry will be unlocked).
                         txEntry.setAndMarkValid(txEntry.previousOperation(), (CacheObject)ret.value());
-                        txEntry.filters(CU.empty());
+                        txEntry.filters(CU.empty0());
                         txEntry.filtersSet(false);
 
                         updateTtl = filter != cacheCtx.noPeekArray();
@@ -2511,14 +2511,12 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         @Nullable final Map<? extends K, GridCacheDrInfo<V>> drMap,
         final boolean retval,
         @Nullable GridCacheEntryEx cached,
-        @Nullable final IgnitePredicate<Cache.Entry<K, V>>[] filter
+        @Nullable final CacheEntryPredicate[] filter
     ) {
         assert filter == null || invokeMap == null;
 
         cacheCtx.checkSecurity(GridSecurityPermission.CACHE_PUT);
 
-        final IgnitePredicate<Cache.Entry<Object, Object>>[] filter0 = ((IgnitePredicate[])filter);
-
         if (retval)
             needReturnValue(true);
 
@@ -2627,7 +2625,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                 invokeArgs,
                 retval,
                 false,
-                filter0,
+                filter,
                 ret,
                 enlisted,
                 drMap,
@@ -2664,7 +2662,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     isolation,
                     isInvalidate(),
                     -1L,
-                    CU.<K, V>empty());
+                    CU.empty0());
 
                 PLC1<GridCacheReturn<CacheObject>> plc1 = new PLC1<GridCacheReturn<CacheObject>>(ret) {
                     @Override public GridCacheReturn<CacheObject> postLock(GridCacheReturn<CacheObject> ret)
@@ -2681,7 +2679,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             retval,
                             /*read*/false,
                             -1L,
-                            filter0,
+                            filter,
                             /*computeInvoke*/true);
 
                         return ret;
@@ -2754,7 +2752,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         Collection<? extends K> keys,
         @Nullable GridCacheEntryEx cached,
         boolean retval,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter
+        CacheEntryPredicate[] filter
     ) {
         return removeAllAsync0(cacheCtx, keys, null, cached, retval, filter);
     }
@@ -2775,11 +2773,9 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         @Nullable Map<? extends  K, GridCacheVersion> drMap,
         @Nullable GridCacheEntryEx cached,
         final boolean retval,
-        @Nullable final IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+        @Nullable final CacheEntryPredicate[] filter) {
         cacheCtx.checkSecurity(GridSecurityPermission.CACHE_REMOVE);
 
-        final IgnitePredicate<Cache.Entry<Object, Object>>[] filter0 = ((IgnitePredicate[])filter);
-
         if (retval)
             needReturnValue(true);
 
@@ -2866,7 +2862,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                 /** invoke arguments */null,
                 retval,
                 /** lock only */false,
-                filter0,
+                filter,
                 ret,
                 enlisted,
                 null,
@@ -2894,7 +2890,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     isolation,
                     isInvalidate(),
                     -1L,
-                    CU.<K, V>empty());
+                    CU.empty0());
 
                 PLC1<GridCacheReturn<CacheObject>> plc1 = new PLC1<GridCacheReturn<CacheObject>>(ret) {
                     @Override protected GridCacheReturn<CacheObject> postLock(GridCacheReturn<CacheObject> ret)
@@ -2911,7 +2907,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             retval,
                             /*read*/false,
                             -1L,
-                            filter0,
+                            filter,
                             /*computeInvoke*/false);
 
                         return ret;
@@ -3059,7 +3055,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                 /** invoke arguments */null,
                 /** retval */false,
                 /** lock only */true,
-                CU.empty(),
+                CU.empty0(),
                 ret,
                 enlisted,
                 null,
@@ -3079,7 +3075,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     isolation,
                     isInvalidate(),
                     -1L,
-                    CU.empty()) :
+                    CU.empty0()) :
                 new GridFinishedFuture<>(cctx.kernalContext());
         }
         catch (IgniteCheckedException e) {
@@ -3193,7 +3189,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         Object[] invokeArgs,
         GridCacheEntryEx entry,
         @Nullable ExpiryPolicy expiryPlc,
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filter,
+        CacheEntryPredicate[] filter,
         boolean filtersSet,
         long drTtl,
         long drExpireTime,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
index 43737e4..1af6378 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
@@ -96,7 +96,7 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
         boolean retval,
         @Nullable GridCacheEntryEx cached,
         long ttl,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter);
+        CacheEntryPredicate[] filter);
 
     /**
      * @param cacheCtx Cache context.
@@ -122,7 +122,7 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
         Collection<? extends K> keys,
         @Nullable GridCacheEntryEx cached,
         boolean retval,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter);
+        CacheEntryPredicate[] filter);
 
     /**
      * @param cacheCtx Cache context.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java b/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
index 92a2789..ce3815c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.util;
 
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -103,6 +104,17 @@ public class F0 {
         };
     }
 
+    public static CacheEntryPredicate and0(@Nullable final CacheEntryPredicate[] p1,
+        @Nullable final CacheEntryPredicate... p2) {
+        return null;
+    }
+
+    public static CacheEntryPredicate and0(
+        @Nullable final CacheEntryPredicate p,
+        @Nullable final CacheEntryPredicate... ps) {
+        return null;
+    }
+
     /**
      * Get a predicate (non peer-deployable) that evaluates to {@code true} if each of its component predicates
      * evaluates to {@code true}. The components are evaluated in order they are supplied.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index 5b99f58..50009c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -390,30 +390,6 @@ public class GridFunc {
     };
 
     /** */
-    private static final IgnitePredicate CACHE_ENTRY_HAS_GET_VAL = new IgnitePredicate() {
-        @SuppressWarnings({"unchecked"})
-        @Override public boolean apply(Object o) {
-            return ((Cache.Entry)o).getValue() != null;
-        }
-
-        @Override public String toString() {
-            return "Cache entry has-get-value predicate.";
-        }
-    };
-
-    /** */
-    private static final IgnitePredicate CACHE_ENTRY_NO_GET_VAL = new IgnitePredicate() {
-        @SuppressWarnings({"unchecked"})
-        @Override public boolean apply(Object o) {
-            return ((Cache.Entry)o).getValue() == null;
-        }
-
-        @Override public String toString() {
-            return "Cache entry no-get-value predicate.";
-        }
-    };
-
-    /** */
     private static final IgnitePredicate CACHE_ENTRY_HAS_PEEK_VAL = new IgnitePredicate() {
         @SuppressWarnings({"unchecked"})
         @Override public boolean apply(Object o) {
@@ -7907,34 +7883,6 @@ public class GridFunc {
     }
 
     /**
-     * Gets predicate which returns {@code true} if {@link org.apache.ignite.cache.Entry#get()}
-     * method returns {@code non-null} value.
-     *
-     * @param <K> Cache key type.
-     * @param <V> Cache value type.
-     * @return Predicate which returns {@code true} if {@link org.apache.ignite.cache.Entry#get()}
-     *      method returns {@code non-null} value.
-     */
-    @SuppressWarnings({"unchecked"})
-    public static <K, V> IgnitePredicate<Cache.Entry<K, V>> cacheHasGetValue() {
-        return (IgnitePredicate<Cache.Entry<K, V>>)CACHE_ENTRY_HAS_GET_VAL;
-    }
-
-    /**
-     * Gets predicate which returns {@code true} if {@link org.apache.ignite.cache.Entry#get()}
-     * method returns {@code null} value.
-     *
-     * @param <K> Cache key type.
-     * @param <V> Cache value type.
-     * @return Predicate which returns {@code true} if {@link org.apache.ignite.cache.Entry#get()}
-     *      method returns {@code null} value.
-     */
-    @SuppressWarnings({"unchecked"})
-    public static <K, V> IgnitePredicate<Cache.Entry<K, V>> cacheNoGetValue() {
-        return (IgnitePredicate<Cache.Entry<K, V>>)CACHE_ENTRY_NO_GET_VAL;
-    }
-
-    /**
      * Gets predicate which returns {@code true} if
      * {@link org.apache.ignite.cache.Entry#peek() Entry.peek()} method
      * returns {@code non-null} value.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 8e4c7cd..f816d75 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,9 +3439,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             info("Local keys (primary): " + locKeys);
 
-            locKeys.addAll(cache.keySet(new IgnitePredicate<Cache.Entry<String, Integer>>() {
-                @Override public boolean apply(Cache.Entry<String, Integer> e) {
-                    return grid(0).affinity(null).isBackup(grid(0).localNode(), e.getKey());
+            locKeys.addAll(cache.keySet(new CacheEntryPredicateAdapter() {
+                @Override public boolean apply(GridCacheEntryEx e) {
+                    return grid(0).affinity(null).isBackup(grid(0).localNode(), e.key());
                 }
             }));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 56eb096..264542f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -386,7 +386,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
     }
 
     /** @inheritDoc */
-    @Override public <K, V> boolean invalidate(@Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter)
+    @Override public <K, V> boolean invalidate(@Nullable CacheEntryPredicate[] filter)
         throws GridCacheEntryRemovedException, IgniteCheckedException {
         assert false;
 
@@ -394,7 +394,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
     }
 
     /** @inheritDoc */
-    @Override public <K, V> boolean compact(@Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter)
+    @Override public <K, V> boolean compact(@Nullable CacheEntryPredicate[] filter)
         throws GridCacheEntryRemovedException, IgniteCheckedException {
         assert false;
 
@@ -403,7 +403,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
 
     /** @inheritDoc */
     @Override public <K, V> boolean evictInternal(boolean swap, GridCacheVersion obsoleteVer,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+        @Nullable CacheEntryPredicate[] filter) {
         assert false;
 
         return false;
@@ -459,7 +459,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
         boolean evt,
         boolean metrics,
         long topVer,
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filter, GridDrType drType,
+        CacheEntryPredicate[] filter, GridDrType drType,
         long drExpireTime, @Nullable GridCacheVersion drVer, UUID subjId, String taskName) throws IgniteCheckedException,
         GridCacheEntryRemovedException {
         return new GridCacheUpdateTxResult(true, rawPut(val, ttl));
@@ -476,7 +476,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
         @Nullable ExpiryPolicy expiryPlc,
         boolean evt,
         boolean metrics,
-        @Nullable IgnitePredicate<Cache.Entry<Object, Object>>[] filter,
+        @Nullable CacheEntryPredicate[] filter,
         boolean intercept,
         UUID subjId,
         String taskName)
@@ -499,7 +499,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
         boolean metrics,
         boolean primary,
         boolean checkVer,
-        @Nullable IgnitePredicate<Cache.Entry<Object, Object>>[] filter,
+        @Nullable CacheEntryPredicate[] filter,
         GridDrType drType,
         long conflictTtl,
         long conflictExpireTime,
@@ -523,7 +523,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
         boolean evt,
         boolean metrics,
         long topVer,
-        IgnitePredicate<Cache.Entry<Object, Object>>[] filter,
+        CacheEntryPredicate[] filter,
         GridDrType drType,
         @Nullable GridCacheVersion drVer,
         UUID subjId,
@@ -540,7 +540,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
 
     /** @inheritDoc */
     @Override public <K, V> boolean clear(GridCacheVersion ver, boolean readers,
-        @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) throws IgniteCheckedException {
+        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
         if (ver == null || ver.equals(this.ver)) {
             val = null;
 
@@ -612,20 +612,20 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
     }
 
     /** @inheritDoc */
-    @Override public <K, V> CacheObject peek(GridCachePeekMode mode, IgnitePredicate<Cache.Entry<K, V>>[] filter) {
+    @Override public <K, V> CacheObject peek(GridCachePeekMode mode, CacheEntryPredicate[] filter) {
         return val;
     }
 
     /** @inheritDoc */
     @Override public <K, V> GridTuple<CacheObject> peek0(boolean failFast, GridCachePeekMode mode,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter, IgniteInternalTx tx)
+        CacheEntryPredicate[] filter, IgniteInternalTx tx)
         throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException {
         return F.t(val);
     }
 
     /** @inheritDoc */
     @Override public <K, V> CacheObject peek(Collection<GridCachePeekMode> modes,
-        IgnitePredicate<Cache.Entry<K, V>>[] filter)
+        CacheEntryPredicate[] filter)
         throws GridCacheEntryRemovedException {
         return val;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
index 24cd202..dc39376 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -631,8 +631,8 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
 
                 assert e != null;
 
-                IgnitePredicate<Cache.Entry<String, Integer>> noPeekVal = F.cacheNoPeekValue();
-                IgnitePredicate<Cache.Entry<String, Integer>> hasPeekVal = F.cacheHasPeekValue();
+                CacheEntryPredicate noPeekVal = new CacheEntrySerializablePredicate(new CacheEntryPredicateNoValue());
+                CacheEntryPredicate hasPeekVal = new CacheEntrySerializablePredicate(new CacheEntryPredicateHasValue());
 
                 String key = e.getKey();
                 Integer val = e.getValue();
@@ -662,8 +662,8 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
 
                 assert e != null;
 
-                IgnitePredicate<Cache.Entry<String, Integer>> noPeekVal = F.cacheNoPeekValue();
-                IgnitePredicate<Cache.Entry<String, Integer>> hasPeekVal = F.cacheHasPeekValue();
+                CacheEntryPredicate noPeekVal = new CacheEntrySerializablePredicate(new CacheEntryPredicateNoValue());
+                CacheEntryPredicate hasPeekVal = new CacheEntrySerializablePredicate(new CacheEntryPredicateHasValue());
 
                 String key = e.getKey();
                 Integer val = e.getValue();
@@ -698,8 +698,8 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
 
                 assert e != null;
 
-                IgnitePredicate<Cache.Entry<String, Integer>> noPeekVal = F.cacheNoPeekValue();
-                IgnitePredicate<Cache.Entry<String, Integer>> hasPeekVal = F.cacheHasPeekValue();
+                CacheEntryPredicate noPeekVal = new CacheEntrySerializablePredicate(new CacheEntryPredicateNoValue());
+                CacheEntryPredicate hasPeekVal = new CacheEntrySerializablePredicate(new CacheEntryPredicateHasValue());
 
                 String key = e.getKey();
                 Integer val = e.getValue();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index c7903df..8ba2047 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -23,7 +23,9 @@ import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 
 import java.util.*;
@@ -321,9 +323,11 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         assertEquals(nearEnabled() ? 2 : 0, cache2.nearSize());
         assertEquals(0, cache2.size() - cache2.nearSize());
 
-        IgniteBiPredicate<String, Integer> prjFilter = new P2<String, Integer>() {
-            @Override public boolean apply(String key, Integer val) {
-                return val >= 1 && val <= 3;
+        CacheEntryPredicateAdapter prjFilter = new CacheEntryPredicateAdapter() {
+            @Override public boolean apply(GridCacheEntryEx e) {
+                Integer val = CU.value(e.rawGet(), e.context(), false);
+
+                return val != null && val >= 1 && val <= 3;
             }
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
index 0c48643..95e43a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.spi.discovery.*;
@@ -222,9 +223,11 @@ public abstract class GridCacheAbstractReduceFieldsQuerySelfTest extends GridCom
      * @throws Exception If failed.
      */
     public void testOnProjection() throws Exception {
-        P2<CacheAffinityKey<String>, Person> p = new P2<CacheAffinityKey<String>, Person>() {
-            @Override public boolean apply(CacheAffinityKey<String> key, Person val) {
-                return val.orgId == 1;
+        CacheEntryPredicateAdapter p = new CacheEntryPredicateAdapter() {
+            @Override public boolean apply(GridCacheEntryEx e) {
+                Person val = CU.value(e.rawGet(), e.context(), false);
+
+                return val != null && val.orgId == 1;
             }
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
index 37b5c08..de1ac5c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
@@ -1037,40 +1037,6 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
         assert res.get(1).equals(25);
     }
 
-    /** @throws Exception If failed. */
-    public void testOnProjection() throws Exception {
-        P2<Integer, Integer> p = new P2<Integer, Integer>() {
-            @Override public boolean apply(Integer key, Integer val) {
-                return val < 30;
-            }
-        };
-
-        CacheProjection<Integer, Integer> cachePrj = ((IgniteKernal)grid(0))
-            .<Integer, Integer>cache(null).projection(p);
-
-        CacheQuery<List<?>> q = cachePrj.queries()
-            .createSqlFieldsQuery("select _key, _val from Integer where _key >= 20 and _val < 40");
-
-        List<List<?>> list = new ArrayList<>(q.execute().get());
-
-        dedup(list);
-
-        Collections.sort(list, new Comparator<List<?>>() {
-            @Override public int compare(List<?> r1, List<?> r2) {
-                return ((Integer)r1.get(0)).compareTo((Integer)r2.get(0));
-            }
-        });
-
-        assertEquals(10, list.size());
-
-        for (int i = 20; i < 30; i++) {
-            List<?> row = list.get(i - 20);
-
-            assertEquals(i, row.get(0));
-            assertEquals(i, row.get(1));
-        }
-    }
-
     /**
      * Dedups result.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractQuerySelfTest.java
index a3173bf..6c9ca23 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractQuerySelfTest.java
@@ -470,11 +470,13 @@ public abstract class GridCacheAbstractQuerySelfTest extends GridCommonAbstractT
         cache.putx(1, new ObjectValue("test", 1));
         cache.putx(2, new ObjectValue("test", 2));
 
-        P2<Integer, ObjectValue> p = new P2<Integer, ObjectValue>() {
-            @Override public boolean apply(Integer key, ObjectValue val) {
-                return val.intVal == 1;
+        CacheEntryPredicate p = new  CacheEntrySerializablePredicate(new CacheEntryPredicateAdapter() {
+            @Override public boolean apply(GridCacheEntryEx e) {
+                ObjectValue val = CU.value(e.rawGet(), e.context(), false);
+
+                return val != null && val.intVal == 1;
             }
-        };
+        });
 
         CacheProjection<Integer, ObjectValue> cachePrj = ((IgniteKernal)grid(0))
             .<Integer, ObjectValue>cache(null).projection(p);
@@ -858,11 +860,13 @@ public abstract class GridCacheAbstractQuerySelfTest extends GridCommonAbstractT
         assert c.putx("key5", 5);
 
         // Filter values less than 3.
-        P2<String, Integer> p = new P2<String, Integer>() {
-            @Override public boolean apply(String key, Integer val) {
-                return val > 3;
+        CacheEntryPredicate p = new  CacheEntrySerializablePredicate(new CacheEntryPredicateAdapter() {
+            @Override public boolean apply(GridCacheEntryEx e) {
+                Integer val = CU.value(e.rawGet(), e.context(), false);
+
+                return val != null && val > 3;
             }
-        };
+        });
 
         CacheProjection<String, Integer> cachePrj = ((IgniteKernal)ignite).<String, Integer>cache(null).projection(p);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
index aa408f4..5bd3621 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
@@ -171,23 +171,6 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest {
         }
     }
 
-    /** @throws Exception If failed. */
-    public void testOnProjection() throws Exception {
-        fillCaches();
-
-        CacheProjection<Integer, FactPurchase> prj = ((IgniteKernal)ignite)
-            .<Integer, FactPurchase>cache("partitioned").projection(
-            new IgnitePredicate<Cache.Entry<Integer, FactPurchase>>() {
-                @Override public boolean apply(Cache.Entry<Integer, FactPurchase> e) {
-                    return e.getKey() > 12;
-                }
-            });
-
-        List<Map.Entry<Integer, FactPurchase>> res = body(prj);
-
-        check(res);
-    }
-
     /**
      * @throws IgniteCheckedException If failed.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6febd89a/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 fc37f09..0a538a0 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
@@ -120,7 +120,9 @@ public class SpringDynamicCacheManager extends SpringCacheManager {
             cache = metaCache.get(key);
 
             if (cache == null) {
-                cache = new SpringCache(name, grid, dataCache.projection(new ProjectionFilter(name)),
+                cache = new SpringCache(name,
+                    grid,
+                    dataCache.projection(new CacheEntrySerializablePredicate(new ProjectionFilter(name))),
                     new DataKeyFactory(name));
 
                 org.springframework.cache.Cache old = metaCache.putIfAbsent(key, cache);
@@ -294,7 +296,7 @@ public class SpringDynamicCacheManager extends SpringCacheManager {
     /**
      * Projection filter.
      */
-    private static class ProjectionFilter implements IgniteBiPredicate<DataKey, Object>, Externalizable {
+    private static class ProjectionFilter extends CacheEntryPredicateAdapter implements Externalizable {
         /** Cache name. */
         private String name;
 
@@ -313,7 +315,9 @@ public class SpringDynamicCacheManager extends SpringCacheManager {
         }
 
         /** {@inheritDoc} */
-        @Override public boolean apply(DataKey key, Object val) {
+        @Override public boolean apply(GridCacheEntryEx e) {
+            DataKey key = e.key().value(e.context(), false);
+
             return name != null ? name.equals(key.name) : key.name == null;
         }
 


Mime
View raw message