ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [10/23] incubator-ignite git commit: # ignite-611
Date Tue, 31 Mar 2015 09:47:44 GMT
# ignite-611


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/10bb5295
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/10bb5295
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/10bb5295

Branch: refs/heads/ignite-sprint-3
Commit: 10bb52954a502e025d6e16aae8fb634b4ea3469f
Parents: 2f0bc37
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Mar 27 14:01:31 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Mar 27 14:01:31 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProjectionEx.java |  1 -
 .../cache/GridCacheProjectionImpl.java          | 84 ++------------------
 ...achePartitionedMultiNodeFullApiSelfTest.java | 21 -----
 3 files changed, 6 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/10bb5295/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
index 048f026..9d1bdf1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
@@ -26,7 +26,6 @@ import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.*;
-import javax.cache.Cache.*;
 import javax.cache.expiry.*;
 import javax.cache.processor.*;
 import java.util.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/10bb5295/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
index fdf59ef..5d09f2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
@@ -83,8 +83,10 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
      * @param parent Parent projection.
      * @param cctx Cache context.
      * @param flags Flags for new projection
+     * @param subjId Subject ID.
+     * @param keepPortable Keep portable flag.
+     * @param expiryPlc Expiry policy.
      */
-    @SuppressWarnings({"unchecked", "TypeMayBeWeakened"})
     public GridCacheProjectionImpl(
         CacheProjection<K, V> parent,
         GridCacheContext<K, V> cctx,
@@ -140,53 +142,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
         return !keepPortable;
     }
 
-    /**
-     * @param k Key.
-     * @param v Value.
-     * @return {@code True} if filter passed.
-     */
-    boolean isAll(K k, V v) {
-        return !(k == null || v == null);
-    }
-
-    /**
-     * @param map Map.
-     * @return {@code True} if filter passed.
-     */
-    Map<? extends K, ? extends V> isAll(Map<? extends K, ? extends V> map) {
-        if (F.isEmpty(map))
-            return Collections.<K, V>emptyMap();
-
-        boolean failed = false;
-
-        // Optimize for passing.
-        for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) {
-            K k = e.getKey();
-            V v = e.getValue();
-
-            if (!isAll(k, v)) {
-                failed = true;
-
-                break;
-            }
-        }
-
-        if (!failed)
-            return map;
-
-        Map<K, V> cp = new HashMap<>(map.size(), 1.0f);
-
-        for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) {
-            K k = e.getKey();
-            V v = e.getValue();
-
-            if (isAll(k, v))
-                cp.put(k, v);
-        }
-
-        return cp;
-    }
-
     /** {@inheritDoc} */
     @SuppressWarnings( {"unchecked", "RedundantCast"})
     @Override public <K1, V1> GridCache<K1, V1> cache() {
@@ -221,7 +176,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
         return subjId;
     }
 
-
     /** {@inheritDoc} */
     @Override public CacheProjection<K, V> flagsOn(@Nullable CacheFlag[] flags) {
         if (F.isEmpty(flags))
@@ -454,10 +408,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
         @Nullable CacheEntryPredicate[] filter) {
         A.notNull(key, "key", val, "val");
 
-        // Check k-v predicate first.
-        if (!isAll(key, val))
-            return new GridFinishedFuture<>();
-
         return cache.putAsync(key, val, entry, ttl, filter);
     }
 
@@ -536,10 +486,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
         long ttl, @Nullable CacheEntryPredicate[] filter) {
         A.notNull(key, "key", val, "val");
 
-        // Check k-v predicate first.
-        if (!isAll(key, val))
-            return new GridFinishedFuture<>(false);
-
         return cache.putxAsync(key, val, entry, ttl, filter);
     }
 
@@ -604,11 +550,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> putAllAsync(Map<? extends K, ? extends
V> m,
         @Nullable CacheEntryPredicate[] filter) {
-        m = isAll(m);
-
-        if (F.isEmpty(m))
-            return new GridFinishedFuture<>();
-
         return cache.putAllAsync(m, filter);
     }
 
@@ -710,18 +651,11 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
 
     /** {@inheritDoc} */
     @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws
IgniteCheckedException {
-        V val = cache.peek(key, modes);
-
-        return isAll(key, val) ? val : null;
+        return cache.peek(key, modes);
     }
 
     /** {@inheritDoc} */
     @Nullable @Override public Cache.Entry<K, V> entry(K key) {
-        V val = peek(key);
-
-        if (!isAll(key, val))
-            return null;
-
         return cache.entry(key);
     }
 
@@ -852,10 +786,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
     @Override public IgniteInternalFuture<GridCacheReturn> replacexAsync(K key, V oldVal,
V newVal) {
         A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal");
 
-        // Check k-v predicate first.
-        if (!isAll(key, newVal))
-            return new GridFinishedFuture<>(new GridCacheReturn(false));
-
         return cache.replacexAsync(key, oldVal, newVal);
     }
 
@@ -871,8 +801,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<GridCacheReturn> removexAsync(K key, V val)
{
-        return !isAll(key, val) ? new GridFinishedFuture<>(
-            new GridCacheReturn(true, false)) : cache.removexAsync(key, val);
+        return cache.removexAsync(key, val);
     }
 
     /** {@inheritDoc} */
@@ -882,8 +811,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> removeAsync(K key, V val) {
-        return !isAll(key, val) ? new GridFinishedFuture<>(false) :
-            cache.removeAsync(key, val);
+        return cache.removeAsync(key, val);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/10bb5295/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 8d9e892..d2feb5b 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
@@ -333,27 +333,6 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         assertEquals(nearEnabled() ? 2 : 0, cache2.localSize(NEAR));
         assertEquals(0, cache2.localSize() - cache2.localSize(NEAR));
-
-
-        assertEquals(0, projectionSize(cache0, NEAR));
-        assertEquals(3, projectionSize(cache0) - projectionSize(cache0, NEAR));
-
-        assertEquals(0, projectionSize(cache1, NEAR));
-        assertEquals(3, projectionSize(cache1) - projectionSize(cache1, NEAR));
-
-        assertEquals(nearEnabled() ? 1 : 0, projectionSize(cache2, NEAR));
-        assertEquals(0, projectionSize(cache2) - projectionSize(cache2, NEAR));
-    }
-
-    private int projectionSize(IgniteCache<String, Integer> cache, CachePeekMode...
modes) {
-        int size = 0;
-
-        for (Cache.Entry<String, Integer> e : cache.localEntries(modes)) {
-            if (e.getValue() != null && e.getValue() >= 1 && e.getValue()
<= 3)
-                size++;
-        }
-
-        return size;
     }
 
     /**


Mime
View raw message