ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [10/22] ignite git commit: Reworked "putAsync".
Date Fri, 01 Apr 2016 08:24:55 GMT
Reworked "putAsync".


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

Branch: refs/heads/ignite-2931
Commit: cc157a03fd6f1fca3de51c3856e8dd90c3089c0b
Parents: 8dc2add
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Mar 31 18:07:05 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Mar 31 18:07:05 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 20 +++++++++++---------
 .../dht/atomic/GridDhtAtomicCache.java          | 12 ++++++------
 .../distributed/near/GridNearAtomicCache.java   |  4 ++--
 .../local/atomic/GridLocalAtomicCache.java      | 20 ++++++++++----------
 4 files changed, 29 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cc157a03/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 5ab9e9a..b5ba006 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
@@ -2153,7 +2153,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
     /** {@inheritDoc} */
     @Override public boolean put(final K key, final V val) throws IgniteCheckedException
{
-        return put(key, val, CU.empty0());
+        return put(key, val, null);
     }
 
     /**
@@ -2165,7 +2165,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
      *      specified.
      * @throws IgniteCheckedException If put operation failed.
      */
-    public boolean put(final K key, final V val, final CacheEntryPredicate[] filter)
+    public boolean put(final K key, final V val, final CacheEntryPredicate filter)
         throws IgniteCheckedException {
         boolean statsEnabled = ctx.config().isStatisticsEnabled();
 
@@ -2178,11 +2178,12 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
         Boolean stored = syncOp(new SyncOp<Boolean>(true) {
             @Override public Boolean op(IgniteTxLocalAdapter tx) throws IgniteCheckedException
{
-                return tx.putAsync(ctx, key, val, false, filter).get().success();
+                return tx.putAsync(ctx, key, val, false,
+                    filter != null ? new CacheEntryPredicate[] { filter } : null).get().success();
             }
 
             @Override public String toString() {
-                return "putx [key=" + key + ", val=" + val + ", filter=" + Arrays.toString(filter)
+ ']';
+                return "putx [key=" + key + ", val=" + val + ", filter=" + filter + ']';
             }
         });
 
@@ -2460,7 +2461,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> putAsync(K key, V val) {
-        return putAsync(key, val, CU.empty0());
+        return putAsync(key, val, null);
     }
 
     /**
@@ -2469,7 +2470,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
      * @param filter Filter.
      * @return Put future.
      */
-    public IgniteInternalFuture<Boolean> putAsync(K key, V val, @Nullable CacheEntryPredicate...
filter) {
+    public IgniteInternalFuture<Boolean> putAsync(K key, V val, @Nullable CacheEntryPredicate
filter) {
         final boolean statsEnabled = ctx.config().isStatisticsEnabled();
 
         final long start = statsEnabled ? System.nanoTime() : 0L;
@@ -2489,7 +2490,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
      * @return Putx operation future.
      */
     public IgniteInternalFuture<Boolean> putAsync0(final K key, final V val,
-        @Nullable final CacheEntryPredicate... filter) {
+        @Nullable final CacheEntryPredicate filter) {
         A.notNull(key, "key", val, "val");
 
         if (keyCheck)
@@ -2497,12 +2498,13 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
         return asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> op(IgniteTxLocalAdapter
tx) {
-                return tx.putAsync(ctx, key, val, false, filter).chain(
+                return tx.putAsync(ctx, key, val, false,
+                    filter != null ? new CacheEntryPredicate[] { filter } : null).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>)RET2FLAG);
             }
 
             @Override public String toString() {
-                return "putxAsync [key=" + key + ", val=" + val + ", filter=" + Arrays.toString(filter)
+ ']';
+                return "putxAsync [key=" + key + ", val=" + val + ", filter=" + filter +
']';
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc157a03/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 fd69018..dd0c736 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
@@ -436,7 +436,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean put(K key, V val, CacheEntryPredicate[] filter) throws IgniteCheckedException
{
+    @Override public boolean put(K key, V val, CacheEntryPredicate filter) throws IgniteCheckedException
{
         return putAsync(key, val, filter).get();
     }
 
@@ -459,7 +459,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable
CacheEntryPredicate... filter) {
+    @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable
CacheEntryPredicate filter) {
         A.notNull(key, "key");
 
         return updateAllAsync0(F0.asMap(key, val),
@@ -469,7 +469,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             null,
             false,
             false,
-            filter,
+            filter != null ? new CacheEntryPredicate[] { filter } : null,
             true,
             UPDATE);
     }
@@ -511,7 +511,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     @Override public IgniteInternalFuture<Boolean> putIfAbsentAsync(K key, V val) {
         A.notNull(key, "key", val, "val");
 
-        return putAsync(key, val, ctx.noValArray());
+        return putAsync(key, val, ctx.noVal());
     }
 
     /** {@inheritDoc} */
@@ -535,7 +535,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     @Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V val) {
         A.notNull(key, "key", val, "val");
 
-        return putAsync(key, val, ctx.hasValArray());
+        return putAsync(key, val, ctx.hasVal());
     }
 
     /** {@inheritDoc} */
@@ -547,7 +547,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     @Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V
newVal) {
         A.notNull(key, "key", oldVal, "oldVal", newVal, "newVal");
 
-        return putAsync(key, newVal, ctx.equalsValArray(oldVal));
+        return putAsync(key, newVal, ctx.equalsVal(oldVal));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc157a03/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 a97c2ac..826bedd 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
@@ -434,7 +434,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K,
V> {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean put(K key, V val, CacheEntryPredicate[] filter) throws IgniteCheckedException
{
+    @Override public boolean put(K key, V val, CacheEntryPredicate filter) throws IgniteCheckedException
{
         return dht.put(key, val, filter);
     }
 
@@ -446,7 +446,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable
CacheEntryPredicate... filter) {
+    @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable
CacheEntryPredicate filter) {
         return dht.putAsync0(key, val, filter);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc157a03/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 67ec606..31b3af6 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
@@ -154,7 +154,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean put(K key, V val, CacheEntryPredicate[] filter) throws IgniteCheckedException
{
+    @Override public boolean put(K key, V val, CacheEntryPredicate filter) throws IgniteCheckedException
{
         A.notNull(key, "key", val, "val");
 
         boolean statsEnabled = ctx.config().isStatisticsEnabled();
@@ -170,7 +170,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
             expiryPerCall(),
             false,
             false,
-            filter,
+            filter != null ? new CacheEntryPredicate[] { filter } : null,
             ctx.writeThrough(),
             ctx.readThrough(),
             opCtx != null && opCtx.isKeepBinary());
@@ -196,7 +196,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable
CacheEntryPredicate... filter) {
+    @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable
CacheEntryPredicate filter) {
         A.notNull(key, "key", val, "val");
 
         return updateAllAsync0(F0.asMap(key, val),
@@ -204,7 +204,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
             null,
             false,
             false,
-            filter);
+            filter != null ? new CacheEntryPredicate[] { filter } : null);
     }
 
     /** {@inheritDoc} */
@@ -220,12 +220,12 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @Override public boolean putIfAbsent(K key, V val) throws IgniteCheckedException {
-        return put(key, val, ctx.noValArray());
+        return put(key, val, ctx.noVal());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> putIfAbsentAsync(K key, V val) {
-        return putAsync(key, val, ctx.noValArray());
+        return putAsync(key, val, ctx.noVal());
     }
 
     /** {@inheritDoc} */
@@ -241,24 +241,24 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
 
     /** {@inheritDoc} */
     @Override public boolean replace(K key, V val) throws IgniteCheckedException {
-        return put(key, val, ctx.hasValArray());
+        return put(key, val, ctx.hasVal());
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V val) {
-        return putAsync(key, val, ctx.hasValArray());
+        return putAsync(key, val, ctx.hasVal());
     }
 
     /** {@inheritDoc} */
     @Override public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException
{
         A.notNull(oldVal, "oldVal");
 
-        return put(key, newVal, ctx.equalsValArray(oldVal));
+        return put(key, newVal, ctx.equalsVal(oldVal));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V
newVal) {
-        return putAsync(key, newVal, ctx.equalsValArray(oldVal));
+        return putAsync(key, newVal, ctx.equalsVal(oldVal));
     }
 
     /** {@inheritDoc} */


Mime
View raw message