ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [4/5] incubator-ignite git commit: #ignite-683: Remove filters from CacheProjection put.
Date Tue, 07 Apr 2015 22:02:07 GMT
#ignite-683: Remove filters from CacheProjection put.


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

Branch: refs/heads/ignite-683-1
Commit: 5c0d6c912101f796f1259a54bfe38c0fa02775b3
Parents: 854e198
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Apr 8 00:58:30 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Apr 8 00:58:30 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheProjection.java       |  5 +--
 .../processors/cache/GridCacheAdapter.java      | 36 +++++++++++++++++++-
 .../cache/GridCacheProjectionImpl.java          |  5 ++-
 .../processors/cache/GridCacheProxyImpl.java    |  4 +--
 4 files changed, 40 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c0d6c91/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 4e93018..1c3c5ff 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
@@ -458,16 +458,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 Previous value associated with specified key, or {@code null}
      *  if entry did not pass the filter, or if there was no mapping for the key in swap
      *  or in persistent storage.
      * @throws NullPointerException If either key or value are {@code null}.
      * @throws IgniteCheckedException If put operation failed.
      */
-    @Nullable public V put(K key, V val, @Nullable CacheEntryPredicate... filter)
-        throws IgniteCheckedException;
+    @Nullable public V put(K key, V val) throws IgniteCheckedException;
 
     /**
      * Asynchronously stores given key-value pair in cache. If filters are provided, then
entries will

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c0d6c91/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 1a8b7b2..9a59f84 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
@@ -2014,7 +2014,41 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
     }
 
     /** {@inheritDoc} */
-    @Override public V put(K key, V val, @Nullable CacheEntryPredicate... filter)
+    @Override public V put(K key, V val) throws IgniteCheckedException {
+        return put(key, val, null, CU.empty0());
+    }
+
+    /**
+     * 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. If cache
+     * previously contained value for the given key, then this value is returned.
+     * In case of {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} caches,
+     * the value will be loaded from the primary node, which in its turn may load the value
+     * from the swap storage, and consecutively, if it's not in swap,
+     * from the underlying persistent storage. If value has to be loaded from persistent
+     * storage,  <code>CacheStore#load(Transaction, Object)</code> method will
be used.
+     * <p>
+     * If the returned value is not needed, method <code>#putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])</code>
should
+     * always be used instead of this one to avoid the overhead associated with returning
of the previous value.
+     * <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 Previous value associated with specified key, or {@code null}
+     *  if entry did not pass the filter, or if there was no mapping for the key in swap
+     *  or in persistent storage.
+     * @throws NullPointerException If either key or value are {@code null}.
+     * @throws IgniteCheckedException If put operation failed.
+     */
+    public V put(K key, V val, @Nullable CacheEntryPredicate... filter)
         throws IgniteCheckedException {
         return put(key, val, null, filter);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c0d6c91/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 96afb74..d1e1f75 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
@@ -349,9 +349,8 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
     }
 
     /** {@inheritDoc} */
-    @Override public V put(K key, V val, @Nullable CacheEntryPredicate[] filter)
-        throws IgniteCheckedException {
-        return putAsync(key, val, null, filter).get();
+    @Override public V put(K key, V val) throws IgniteCheckedException {
+        return putAsync(key, val, null, CU.empty0()).get();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c0d6c91/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 9627864..ec96de9 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
@@ -578,12 +578,12 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K,
V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public V put(K key, V val, @Nullable CacheEntryPredicate[] filter)
+    @Nullable @Override public V put(K key, V val)
         throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
-            return delegate.put(key, val, filter);
+            return delegate.put(key, val);
         }
         finally {
             gate.leave(prev);


Mime
View raw message