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 6550C178B6 for ; Tue, 7 Apr 2015 22:02:30 +0000 (UTC) Received: (qmail 57450 invoked by uid 500); 7 Apr 2015 22:02:27 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 57420 invoked by uid 500); 7 Apr 2015 22:02:27 -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 57410 invoked by uid 99); 7 Apr 2015 22:02:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2015 22:02:27 +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; Tue, 07 Apr 2015 22:02:25 +0000 Received: (qmail 56275 invoked by uid 99); 7 Apr 2015 22:02:05 -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; Tue, 07 Apr 2015 22:02:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ED847E1874; Tue, 7 Apr 2015 22:02:04 +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 Date: Tue, 07 Apr 2015 22:02:07 -0000 Message-Id: In-Reply-To: <8a7fa9eda27a43429439bd737e86785d@git.apache.org> References: <8a7fa9eda27a43429439bd737e86785d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/5] incubator-ignite git commit: #ignite-683: Remove filters from CacheProjection put. X-Virus-Checked: Checked by ClamAV on apache.org #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 Authored: Wed Apr 8 00:58:30 2015 +0300 Committer: ivasilinets 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 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 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 implements GridCache, } /** {@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, 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 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 implements GridCacheProjectionEx implements GridCacheProxy, 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 prev = gate.enter(prj); try { - return delegate.put(key, val, filter); + return delegate.put(key, val); } finally { gate.leave(prev);