#ignite-683: Remove filter from GridCacheProjection.putx.

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

Branch: refs/heads/ignite-683
Commit: ac488d362f89537f1314d565dbe9703082901e1c
Parents: 8b4b562
Author: ivasilinets <ivasilin...@gridgain.com>
Authored: Tue Apr 7 01:11:01 2015 +0300
Committer: ivasilinets <ivasilin...@gridgain.com>
Committed: Tue Apr 7 01:11:01 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheProjection.java       |  4 +--
 .../processors/cache/GridCacheAdapter.java      | 33 +++++++++++++++++++-
 .../cache/GridCacheProjectionImpl.java          |  5 ++-
 .../processors/cache/GridCacheProxyImpl.java    |  4 +--
 .../local/atomic/GridLocalAtomicCache.java      |  6 ++++
 5 files changed, 43 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac488d36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
index 3897125..5312ccc 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
@@ -518,15 +518,13 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      *
      * @param key Key to store in cache.
      * @param val Value to be associated with the given key.
-     * @param filter Optional filter to check prior to putting value in cache. 
Note
-     *      that filter check is atomic with put operation.
      * @return {@code True} if optional filter passed and value was stored in 
cache,
      *      {@code false} otherwise. Note that this method will return {@code 
true} if filter is not
      *      specified.
      * @throws NullPointerException If either key or value are {@code null}.
      * @throws IgniteCheckedException If put operation failed.
      */
-    public boolean putx(K key, V val, @Nullable CacheEntryPredicate... filter)
+    public boolean putx(K key, V val)
         throws IgniteCheckedException;
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac488d36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 38c8c28..6316175 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -2113,7 +2113,38 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
     }
 
     /** {@inheritDoc} */
-    @Override public boolean putx(final K key, final V val,
+    @Override public boolean putx(K key,
+                                  V val) throws IgniteCheckedException {
+        return putx(key, val, null);
+    }
+
+    /**
+     * Stores given key-value pair in cache. If filters are provided, then 
entries will
+     * be stored in cache only if they pass the filter. Note that filter check 
is atomic,
+     * so value stored in cache is guaranteed to be consistent with the 
filters.
+     * <p>
+     * This method will return {@code true} if value is stored in cache and 
{@code false} otherwise.
+     * Unlike <code>#put(Object, Object, 
org.apache.ignite.lang.IgnitePredicate[])</code> method, it does not return 
previous
+     * value and, therefore, does not have any overhead associated with 
returning a value. It
+     * should be used whenever return value is not required.
+     * <p>
+     * If write-through is enabled, the stored value will be persisted to 
{@link org.apache.ignite.cache.store.CacheStore}
+     * via <code>CacheStore#put(Transaction, Object, Object)</code> method.
+     * <h2 class="header">Transactions</h2>
+     * This method is transactional and will enlist the entry into ongoing 
transaction
+     * if there is one.
+     *
+     * @param key Key to store in cache.
+     * @param val Value to be associated with the given key.
+     * @param filter Optional filter to check prior to putting value in cache. 
Note
+     *      that filter check is atomic with put operation.
+     * @return {@code True} if optional filter passed and value was stored in 
cache,
+     *      {@code false} otherwise. Note that this method will return {@code 
true} if filter is not
+     *      specified.
+     * @throws NullPointerException If either key or value are {@code null}.
+     * @throws IgniteCheckedException If put operation failed.
+     */
+    public boolean putx(final K key, final V val,
         final CacheEntryPredicate[] filter) throws IgniteCheckedException {
         boolean statsEnabled = ctx.config().isStatisticsEnabled();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac488d36/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 4c5cb59..7bf3515 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
@@ -381,9 +381,8 @@ public class GridCacheProjectionImpl<K, V> implements 
GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public boolean putx(K key, V val,
-        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
-        return putxAsync(key, val, filter).get();
+    @Override public boolean putx(K key, V val) throws IgniteCheckedException {
+        return putxAsync(key, val, null).get();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac488d36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index b25f914..b7719b0 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -643,12 +643,12 @@ public class GridCacheProxyImpl<K, V> implements 
GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public boolean putx(K key, V val, @Nullable 
CacheEntryPredicate[] filter)
+    @Override public boolean putx(K key, V val)
         throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
-            return delegate.putx(key, val, filter);
+            return delegate.putx(key, val);
         }
         finally {
             gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac488d36/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 5fb93d6..985c27c 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
@@ -138,6 +138,12 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
 
     /** {@inheritDoc} */
     @Override public boolean putx(K key,
+                                  V val) throws IgniteCheckedException {
+        return putx(key, val, null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putx(K key,
         V val,
         CacheEntryPredicate[] filter) throws IgniteCheckedException {
         A.notNull(key, "key", val, "val");

Reply via email to