ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/5] incubator-ignite git commit: #ignite-683: Remove put(final K key, final V val, @Nullable final GridCacheEntryEx cached, @Nullable final CacheEntryPredicate... filter).
Date Wed, 08 Apr 2015 16:04:44 GMT
#ignite-683: Remove put(final K key, final V val, @Nullable final GridCacheEntryEx cached,
@Nullable final CacheEntryPredicate... filter).


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

Branch: refs/heads/ignite-683
Commit: 06cc5d826d72dfb59abb78c3133e7e5e95d55ff2
Parents: b48bd4b
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Apr 8 18:38:37 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Apr 8 18:38:37 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 87 +++-----------------
 .../cache/GridCacheProjectionImpl.java          |  4 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  8 +-
 .../distributed/near/GridNearAtomicCache.java   | 10 +--
 .../local/atomic/GridLocalAtomicCache.java      | 10 +--
 .../dht/GridCacheDhtEvictionSelfTest.java       |  4 +-
 6 files changed, 26 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06cc5d82/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 7d6fe9f..e26b619 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
@@ -2015,42 +2015,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
     /** {@inheritDoc} */
     @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);
+        return put(key, val, CU.empty0());
     }
 
     /**
@@ -2058,15 +2023,13 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
      *
      * @param key Key.
      * @param val Value.
-     * @param cached Cached entry. If not provided, equivalent to {CacheProjection#put}.
      * @param filter Optional filter.
      * @return Previous value.
      * @throws IgniteCheckedException If failed.
      */
     @Nullable public V put(final K key,
-        final V val,
-        @Nullable final GridCacheEntryEx cached,
-        @Nullable final CacheEntryPredicate[] filter)
+                           final V val,
+                           @Nullable final CacheEntryPredicate[] filter)
         throws IgniteCheckedException
     {
         boolean statsEnabled = ctx.config().isStatisticsEnabled();
@@ -2082,7 +2045,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
         V prevVal = syncOp(new SyncOp<V>(true) {
             @Override public V op(IgniteTxLocalAdapter tx) throws IgniteCheckedException
{
-                return (V)tx.putAllAsync(ctx, F.t(key, val), true, cached, filter).get().value();
+                return (V)tx.putAllAsync(ctx, F.t(key, val), true, null, filter).get().value();
             }
 
             @Override public String toString() {
@@ -2102,41 +2065,19 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
     }
 
     /**
-     * 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,  <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.
+     * Internal method that is called from {@link CacheEntryImpl}.
      *
-     * @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}.
+     * @param key Key.
+     * @param val Value.
+     * @param filter Optional filter.
+     * @return Put operation future.
      */
-    public IgniteInternalFuture<V> putAsync(K key, V val,
-        @Nullable CacheEntryPredicate[] filter) {
+    public IgniteInternalFuture<V> putAsync(final K key, final V val, @Nullable final
CacheEntryPredicate... filter) {
         final boolean statsEnabled = ctx.config().isStatisticsEnabled();
 
         final long start = statsEnabled ? System.nanoTime() : 0L;
 
-        IgniteInternalFuture<V> fut = putAsync(key, val, null, filter);
+        IgniteInternalFuture<V> fut = putAsync0(key, val, filter);
 
         if (statsEnabled)
             fut.listen(new UpdatePutAndGetTimeStatClosure<V>(metrics0(), start));
@@ -2149,12 +2090,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
      *
      * @param key Key.
      * @param val Value.
-     * @param entry Optional cached entry.
      * @param filter Optional filter.
      * @return Put operation future.
      */
-    public IgniteInternalFuture<V> putAsync(final K key, final V val, @Nullable final
GridCacheEntryEx entry,
-        @Nullable final CacheEntryPredicate... filter) {
+    public IgniteInternalFuture<V> putAsync0(final K key, final V val, @Nullable final
CacheEntryPredicate... filter) {
         A.notNull(key, "key", val, "val");
 
         if (keyCheck)
@@ -2164,7 +2103,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
         return asyncOp(new AsyncOp<V>(key) {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter tx) {
-                return tx.putAllAsync(ctx, F.t(key, val), true, entry, filter)
+                return tx.putAllAsync(ctx, F.t(key, val), true, null, filter)
                     .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>,
V>)RET2VAL);
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06cc5d82/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 6394c45..8a8084a 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
@@ -426,7 +426,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<V> putIfAbsentAsync(K key, V val) {
-        return cache.putAsync(key, val, null, cctx.noValArray());
+        return cache.putAsync(key, val, cctx.noValArray());
     }
 
     /** {@inheritDoc} */
@@ -446,7 +446,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K,
V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<V> replaceAsync(K key, V val) {
-        return cache.putAsync(key, val, null, cctx.hasValArray());
+        return cache.putAsync(key, val, cctx.hasValArray());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06cc5d82/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index c928887..dfa3954 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -301,9 +301,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     }
 
     /** {@inheritDoc} */
-    @Override public V put(K key, V val, @Nullable GridCacheEntryEx cached,
-        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
-        return putAsync(key, val, cached, filter).get();
+    @Override public V put(K key, V val, @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException
{
+        return putAsync(key, val, filter).get();
     }
 
     /** {@inheritDoc} */
@@ -314,8 +313,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx
entry,
-        @Nullable CacheEntryPredicate... filter) {
+    @Override public IgniteInternalFuture<V> putAsync0(K key, V val, @Nullable CacheEntryPredicate...
filter) {
         A.notNull(key, "key");
 
         return updateAllAsync0(F0.asMap(key, val),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06cc5d82/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index fcbd9f6..d21ba05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -391,10 +391,9 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K,
V> {
     @Override public V put(
         K key,
         V val,
-        @Nullable GridCacheEntryEx cached,
         @Nullable CacheEntryPredicate[] filter
     ) throws IgniteCheckedException {
-        return dht.put(key, val, cached, filter);
+        return dht.put(key, val, filter);
     }
 
     /** {@inheritDoc} */
@@ -406,11 +405,8 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<V> putAsync(K key,
-        V val,
-        @Nullable GridCacheEntryEx entry,
-        @Nullable CacheEntryPredicate... filter) {
-        return dht.putAsync(key, val, entry, filter);
+    @Override public IgniteInternalFuture<V> putAsync0(K key, V val, @Nullable CacheEntryPredicate...
filter) {
+        return dht.putAsync(key, val, filter);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06cc5d82/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 aa0ab56..66a8d7a 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
@@ -101,9 +101,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public V put(K key,
-        V val,
-        @Nullable GridCacheEntryEx cached,
-        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
+                           V val,
+                           @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException
{
         A.notNull(key, "key", val, "val");
 
         return (V)updateAllInternal(UPDATE,
@@ -141,10 +140,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<V> putAsync(K key,
-        V val,
-        @Nullable GridCacheEntryEx entry,
-        @Nullable CacheEntryPredicate... filter) {
+    @Override public IgniteInternalFuture<V> putAsync0(K key, V val, @Nullable CacheEntryPredicate...
filter) {
         A.notNull(key, "key", val, "val");
 
         return updateAllAsync0(F0.asMap(key, val),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06cc5d82/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
index 39ef872..4c3d2a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
@@ -208,7 +208,7 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest
{
         String val = "v1";
 
         // Put on primary node.
-        nearPrimary.put(key, val, null);
+        nearPrimary.put(key, val);
 
         assertEquals(val, localPeek(nearPrimary, key));
         assertEquals(val, localPeek(dhtPrimary, key));
@@ -276,7 +276,7 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest
{
 
         // Put on primary node.
         for (Integer key : keys)
-            nearPrimary.put(key, "v" + key, null);
+            nearPrimary.put(key, "v" + key);
 
         for (Integer key : keys) {
             String val = "v" + key;


Mime
View raw message