Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C42D217FCC for ; Mon, 6 Apr 2015 22:27:54 +0000 (UTC) Received: (qmail 74612 invoked by uid 500); 6 Apr 2015 22:27:54 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 74582 invoked by uid 500); 6 Apr 2015 22:27:54 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 74573 invoked by uid 99); 6 Apr 2015 22:27:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 22:27:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 06 Apr 2015 22:27:48 +0000 Received: (qmail 74154 invoked by uid 99); 6 Apr 2015 22:27:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 22:27:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 59842E181A; Mon, 6 Apr 2015 22:27:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: <9cd63681d8b94c16b4ee45a0e6aa8efd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: #ignite-683: Remove filter from GridCacheProjection.putAsync. Date: Mon, 6 Apr 2015 22:27:28 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-683-1 ac488d362 -> acb6afc1f #ignite-683: Remove filter from GridCacheProjection.putAsync. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/acb6afc1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/acb6afc1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/acb6afc1 Branch: refs/heads/ignite-683-1 Commit: acb6afc1f231094915f790417b8f38410fe4401b Parents: ac488d3 Author: ivasilinets Authored: Tue Apr 7 01:27:21 2015 +0300 Committer: ivasilinets Committed: Tue Apr 7 01:27:21 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/CacheProjection.java | 8 +-- .../processors/cache/GridCacheAdapter.java | 66 +++++++++++++++++++- .../cache/GridCacheProjectionImpl.java | 22 +++---- .../processors/cache/GridCacheProxyImpl.java | 10 ++- 4 files changed, 80 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/acb6afc1/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 5312ccc..2e959d6 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 @@ -493,12 +493,10 @@ public interface CacheProjection extends Iterable> { * * @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 Future for the put operation. * @throws NullPointerException If either key or value are {@code null}. */ - public IgniteInternalFuture putAsync(K key, V val, @Nullable CacheEntryPredicate... filter); + public IgniteInternalFuture putAsync(K key, V val); /** * Stores given key-value pair in cache. If filters are provided, then entries will @@ -545,14 +543,12 @@ public interface CacheProjection extends Iterable> { * * @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 Future for the put operation. Future will return {@code true} if optional filter * passed and value was stored in cache, {@code false} otherwise. Note that future will * return {@code true} if filter is not specified. * @throws NullPointerException If either key or value are {@code null}. */ - public IgniteInternalFuture putxAsync(K key, V val, @Nullable CacheEntryPredicate... filter); + public IgniteInternalFuture putxAsync(K key, V val); /** * Stores given key-value pair in cache only if cache had no previous mapping for it. If cache http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/acb6afc1/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 6316175..0481f7b 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 @@ -2076,7 +2076,40 @@ public abstract class GridCacheAdapter implements GridCache, } /** {@inheritDoc} */ - @Override public IgniteInternalFuture putAsync(K key, V val, + @Override public IgniteInternalFuture putAsync(K key, V val) { + return putAsync(key, val, null); + } + + /** + * Asynchronously 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. Otherwise, + * in case of {@link CacheMode#REPLICATED} caches, the value will be loaded from swap + * and, if it's not there, and read-through is allowed, from the underlying + * {@link org.apache.ignite.cache.store.CacheStore} storage. In case of {@link CacheMode#PARTITIONED} 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 and read-through is allowed, + * from the underlying persistent storage. If value has to be loaded from persistent + * storage, CacheStore#load(Transaction, Object) method will be used. + *

+ * If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) should + * always be used instead of this one to avoid the overhead associated with returning of the previous value. + *

+ * If write-through is enabled, the stored value will be persisted to {@link org.apache.ignite.cache.store.CacheStore} + * via CacheStore#put(Transaction, Object, Object) method. + *

Transactions

+ * 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 Future for the put operation. + * @throws NullPointerException If either key or value are {@code null}. + */ + public IgniteInternalFuture putAsync(K key, V val, @Nullable CacheEntryPredicate[] filter) { final boolean statsEnabled = ctx.config().isStatisticsEnabled(); @@ -2411,7 +2444,36 @@ public abstract class GridCacheAdapter implements GridCache, } /** {@inheritDoc} */ - @Override public IgniteInternalFuture putxAsync(K key, V val, + @Override public IgniteInternalFuture putxAsync(K key, V val) { + return putxAsync(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. + *

+ * This method will return {@code true} if value is stored in cache and {@code false} otherwise. + * Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous + * value and, therefore, does not have any overhead associated with returning of a value. It + * should always be used whenever return value is not required. + *

+ * If write-through is enabled, the stored value will be persisted to {@link org.apache.ignite.cache.store.CacheStore} + * via CacheStore#put(Transaction, Object, Object) method. + *

Transactions

+ * 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 Future for the put operation. Future will return {@code true} if optional filter + * passed and value was stored in cache, {@code false} otherwise. Note that future will + * return {@code true} if filter is not specified. + * @throws NullPointerException If either key or value are {@code null}. + */ + public IgniteInternalFuture putxAsync(K key, V val, @Nullable CacheEntryPredicate... filter) { final boolean statsEnabled = ctx.config().isStatisticsEnabled(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/acb6afc1/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 7bf3515..26cb783 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 @@ -351,7 +351,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx implements GridCacheProjectionEx putAsync(K key, V val, - @Nullable CacheEntryPredicate[] filter) { - return putAsync(key, val, null, filter); + @Override public IgniteInternalFuture putAsync(K key, V val) { + return putAsync(key, val, null, null); } /** {@inheritDoc} */ @@ -382,7 +381,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx implements GridCacheProjectionEx putxAsync(K key, V val, - @Nullable CacheEntryPredicate[] filter) { - return putxAsync(key, val, null, filter); + @Override public IgniteInternalFuture putxAsync(K key, V val) { + return putxAsync(key, val, null, null); } /** {@inheritDoc} */ @@ -458,7 +456,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx putIfAbsentAsync(K key, V val) { - return putAsync(key, val, cctx.noValArray()); + return cache.putAsync(key, val, null, cctx.noValArray()); } /** {@inheritDoc} */ @@ -468,7 +466,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx putxIfAbsentAsync(K key, V val) { - return putxAsync(key, val, cctx.noValArray()); + return cache.putxAsync(key, val, null, cctx.noValArray()); } /** {@inheritDoc} */ @@ -478,7 +476,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx replaceAsync(K key, V val) { - return putAsync(key, val, cctx.hasValArray()); + return cache.putAsync(key, val, null, cctx.hasValArray()); } /** {@inheritDoc} */ @@ -488,7 +486,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx replacexAsync(K key, V val) { - return putxAsync(key, val, cctx.hasValArray()); + return cache.putxAsync(key, val, null, cctx.hasValArray()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/acb6afc1/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 b7719b0..b7665a3 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 @@ -604,12 +604,11 @@ public class GridCacheProxyImpl implements GridCacheProxy, Externali } /** {@inheritDoc} */ - @Override public IgniteInternalFuture putAsync(K key, V val, - @Nullable CacheEntryPredicate[] filter) { + @Override public IgniteInternalFuture putAsync(K key, V val) { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.putAsync(key, val, filter); + return delegate.putAsync(key, val); } finally { gate.leave(prev); @@ -766,12 +765,11 @@ public class GridCacheProxyImpl implements GridCacheProxy, Externali } /** {@inheritDoc} */ - @Override public IgniteInternalFuture putxAsync(K key, V val, - @Nullable CacheEntryPredicate[] filter) { + @Override public IgniteInternalFuture putxAsync(K key, V val) { GridCacheProjectionImpl prev = gate.enter(prj); try { - return delegate.putxAsync(key, val, filter); + return delegate.putxAsync(key, val); } finally { gate.leave(prev);