ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [20/22] ignite git commit: Finalization.
Date Fri, 01 Apr 2016 08:25:05 GMT
Finalization.


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

Branch: refs/heads/ignite-2931
Commit: 299538b85a248e0fa9dda150b42e92579faa6468
Parents: 513545d
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Apr 1 10:42:44 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Apr 1 10:42:44 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 26 ++++-------
 .../processors/cache/GridCacheContext.java      | 22 ---------
 .../processors/cache/GridCacheUtils.java        | 10 +++++
 .../dht/atomic/GridDhtAtomicCache.java          | 22 +++------
 .../local/atomic/GridLocalAtomicCache.java      |  2 +-
 .../transactions/IgniteTxLocalAdapter.java      | 47 +++++++++-----------
 .../cache/transactions/IgniteTxLocalEx.java     |  2 +-
 7 files changed, 49 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/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 875e0e0..cfef152 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
@@ -2818,7 +2818,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 V ret = tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
                     /*retval*/true,
-                    CU.empty0(),
+                    null,
                     /*singleRmv*/false).get().value();
 
                 if (ctx.config().getInterceptor() != null)
@@ -2855,7 +2855,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
                     /*retval*/true,
-                    CU.empty0(),
+                    null,
                     /*singleRmv*/false).chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>,
V>)RET2VAL);
             }
 
@@ -2905,7 +2905,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 tx.removeAllAsync(ctx,
                     keys,
                     /*retval*/false,
-                    CU.empty0(),
+                    null,
                     /*singleRmv*/false).get();
             }
 
@@ -2935,7 +2935,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return tx.removeAllAsync(ctx,
                     keys,
                     /*retval*/false,
-                    CU.empty0(),
+                    null,
                     /*singleRmv*/false).chain(RET2NULL);
             }
 
@@ -2966,7 +2966,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
                     /*retval*/false,
-                    CU.empty0(),
+                    null,
                     /*singleRmv*/true).get().success();
             }
 
@@ -3008,7 +3008,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
                     /*retval*/false,
-                    filterArray(filter),
+                    filter,
                     /*singleRmv*/true).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>)RET2FLAG);
             }
@@ -3082,7 +3082,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
                     /*retval*/false,
-                    ctx.equalsValArray(val),
+                    ctx.equalsVal(val),
                     /*singleRmv*/false).get().success();
             }
 
@@ -3123,7 +3123,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return tx.removeAllAsync(ctx,
                     Collections.singletonList(key),
                     /*retval*/false,
-                    ctx.equalsValArray(val),
+                    ctx.equalsVal(val),
                     /*singleRmv*/false).chain(
                     (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>)RET2FLAG);
             }
@@ -4801,16 +4801,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
     }
 
     /**
-     * Create filter array.
-     *
-     * @param filter Filter.
-     * @return Filter array.
-     */
-    public static CacheEntryPredicate[] filterArray(@Nullable CacheEntryPredicate filter)
{
-        return filter != null ? new CacheEntryPredicate[] { filter } : CU.empty0();
-    }
-
-    /**
      *
      */
     private class AsyncOpRetryFuture<T> extends GridFutureAdapter<T> {

http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 718cfd6..e948c8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1112,13 +1112,6 @@ public class GridCacheContext<K, V> implements Externalizable
{
     }
 
     /**
-     * @return No value filter.
-     */
-    public CacheEntryPredicate[] noValArray() {
-        return new CacheEntryPredicate[]{new CacheEntrySerializablePredicate(new CacheEntryPredicateNoValue())};
-    }
-
-    /**
      * @return Has value filter.
      */
     public CacheEntryPredicate hasVal() {
@@ -1126,13 +1119,6 @@ public class GridCacheContext<K, V> implements Externalizable
{
     }
 
     /**
-     * @return Has value filter.
-     */
-    public CacheEntryPredicate[] hasValArray() {
-        return new CacheEntryPredicate[]{new CacheEntrySerializablePredicate(new CacheEntryPredicateHasValue())};
-    }
-
-    /**
      * @param val Value to check.
      * @return Predicate that checks for value.
      */
@@ -1141,14 +1127,6 @@ public class GridCacheContext<K, V> implements Externalizable
{
     }
 
     /**
-     * @param val Value to check.
-     * @return Predicate array that checks for value.
-     */
-    public CacheEntryPredicate[] equalsValArray(V val) {
-        return new CacheEntryPredicate[]{new CacheEntryPredicateContainsValue(toCacheObject(val))};
-    }
-
-    /**
      * @return Empty cache version array.
      */
     public GridCacheVersion[] emptyVersion() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 1cdd303..4744580 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -381,6 +381,16 @@ public class GridCacheUtils {
     }
 
     /**
+     * Create filter array.
+     *
+     * @param filter Filter.
+     * @return Filter array.
+     */
+    public static CacheEntryPredicate[] filterArray(@Nullable CacheEntryPredicate filter)
{
+        return filter != null ? new CacheEntryPredicate[] { filter } : CU.empty0();
+    }
+
+    /**
      * Entry predicate factory mostly used for deserialization.
      *
      * @param <K> Key type.

http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/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 16881f8..3b7d0ff 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
@@ -557,7 +557,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             null,
             false,
             false,
-            CU.empty0(),
             true,
             UPDATE).chain(RET2NULL);
     }
@@ -579,7 +578,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             null,
             false,
             false,
-            null,
             true,
             UPDATE);
     }
@@ -606,7 +604,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     @Override public IgniteInternalFuture<?> removeAllAsync(Collection<? extends
K> keys) {
         A.notNull(keys, "keys");
 
-        return removeAllAsync0(keys, null, false, false, CU.empty0()).chain(RET2NULL);
+        return removeAllAsync0(keys, null, false, false).chain(RET2NULL);
     }
 
     /** {@inheritDoc} */
@@ -644,7 +642,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     @Override public IgniteInternalFuture<?> removeAllConflictAsync(Map<KeyCacheObject,
GridCacheVersion> conflictMap) {
         ctx.dr().onReceiveCacheEntriesReceived(conflictMap.size());
 
-        return removeAllAsync0(null, conflictMap, false, false, null);
+        return removeAllAsync0(null, conflictMap, false, false);
     }
 
     /**
@@ -807,7 +805,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             null,
             false,
             false,
-            null,
             true,
             TRANSFORM);
 
@@ -844,7 +841,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             null,
             false,
             false,
-            null,
             true,
             TRANSFORM);
     }
@@ -859,7 +855,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
      * @param conflictRmvMap Conflict remove map.
      * @param retval Return value required flag.
      * @param rawRetval Return {@code GridCacheReturn} instance.
-     * @param filter Cache entry filter for atomic updates.
      * @param waitTopFut Whether to wait for topology future.
      * @return Completion future.
      */
@@ -872,7 +867,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         @Nullable Map<KeyCacheObject, GridCacheVersion> conflictRmvMap,
         final boolean retval,
         final boolean rawRetval,
-        @Nullable final CacheEntryPredicate[] filter,
         final boolean waitTopFut,
         final GridCacheOperation op
     ) {
@@ -943,7 +937,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             retval,
             rawRetval,
             opCtx != null ? opCtx.expiry() : null,
-            filter,
+            CU.filterArray(null),
             subjId,
             taskNameHash,
             opCtx != null && opCtx.skipStore(),
@@ -1088,7 +1082,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             retval,
             false,
             opCtx != null ? opCtx.expiry() : null,
-            filter != null ? new CacheEntryPredicate[] { filter } : null,
+            CU.filterArray(filter),
             ctx.subjectIdPerCall(null, opCtx),
             ctx.kernalContext().job().currentTaskNameHash(),
             opCtx != null && opCtx.skipStore(),
@@ -1104,15 +1098,13 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
      * @param conflictMap Conflict map.
      * @param retval Return value required flag.
      * @param rawRetval Return {@code GridCacheReturn} instance.
-     * @param filter Cache entry filter for atomic removes.
      * @return Completion future.
      */
     private IgniteInternalFuture removeAllAsync0(
         @Nullable Collection<? extends K> keys,
         @Nullable Map<KeyCacheObject, GridCacheVersion> conflictMap,
         final boolean retval,
-        boolean rawRetval,
-        @Nullable final CacheEntryPredicate[] filter
+        boolean rawRetval
     ) {
         assert ctx.updatesAllowed();
 
@@ -1157,8 +1149,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             drVers != null ? drVers : (keys != null ? null : conflictMap.values()),
             retval,
             rawRetval,
-            (filter != null && opCtx != null) ? opCtx.expiry() : null,
-            filter,
+            opCtx != null ? opCtx.expiry() : null,
+            CU.filterArray(null),
             subjId,
             taskNameHash,
             opCtx != null && opCtx.skipStore(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/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 8774b04..1632112 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
@@ -925,7 +925,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
 
         UUID subjId = ctx.subjectIdPerCall(null);
 
-        CacheEntryPredicate[] filters = filterArray(filter);
+        CacheEntryPredicate[] filters = CU.filterArray(filter);
 
         if (writeThrough && keys.size() > 1) {
             return updateWithBatch(op,

http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 2d863f5..8c5c8eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2040,8 +2040,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
             null,
             null,
             null,
-            retval,
-            GridCacheAdapter.filterArray(null));
+            retval);
     }
 
     /** {@inheritDoc} */
@@ -2051,7 +2050,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
         V val,
         boolean retval,
         CacheEntryPredicate filter) {
-        return putAsync0(cacheCtx, key, val, null, null, retval, GridCacheAdapter.filterArray(filter));
+        return putAsync0(cacheCtx, key, val, null, null, retval, filter);
     }
 
     /** {@inheritDoc} */
@@ -2078,8 +2077,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
             null,
             null,
             drMap,
-            false,
-            null);
+            false);
     }
 
     /** {@inheritDoc} */
@@ -2094,8 +2092,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
             map,
             invokeArgs,
             null,
-            true,
-            null);
+            true);
     }
 
     /** {@inheritDoc} */
@@ -3033,7 +3030,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
         @Nullable EntryProcessor<K, V, Object> entryProcessor,
         @Nullable final Object[] invokeArgs,
         final boolean retval,
-        @Nullable final CacheEntryPredicate[] filter
+        @Nullable final CacheEntryPredicate filter
     ) {
         assert key != null;
 
@@ -3050,6 +3047,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
 
             boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
 
+            final CacheEntryPredicate[] filters = CU.filterArray(filter);
+
             final IgniteInternalFuture<Void> loadFut = enlistWrite(
                 cacheCtx,
                 cacheKey,
@@ -3059,7 +3058,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                 invokeArgs,
                 retval,
                 /*lockOnly*/false,
-                filter,
+                filters,
                 ret,
                 opCtx != null && opCtx.skipStore(),
                 /*singleRmv*/false,
@@ -3100,7 +3099,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                             retval,
                             /*read*/false,
                             -1L,
-                            filter,
+                            filters,
                             /*computeInvoke*/true);
 
                         return ret;
@@ -3153,7 +3152,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
      * @param invokeArgs Optional arguments for EntryProcessor.
      * @param drMap DR map.
      * @param retval Key-transform value map to store.
-     * @param filter Filter.
      * @return Operation future.
      */
     @SuppressWarnings("unchecked")
@@ -3163,11 +3161,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
implements Ig
         @Nullable Map<? extends K, ? extends EntryProcessor<K, V, Object>> invokeMap,
         @Nullable final Object[] invokeArgs,
         @Nullable Map<KeyCacheObject, GridCacheDrInfo> drMap,
-        final boolean retval,
-        @Nullable final CacheEntryPredicate[] filter
+        final boolean retval
     ) {
-        assert filter == null || invokeMap == null;
-
         try {
             beforePut(cacheCtx, retval);
         }
@@ -3227,7 +3222,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                 invokeArgs,
                 retval,
                 false,
-                filter,
+                CU.filterArray(null),
                 ret,
                 enlisted,
                 drMap,
@@ -3275,7 +3270,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                             retval,
                             /*read*/false,
                             -1L,
-                            filter,
+                            CU.filterArray(null),
                             /*computeInvoke*/true);
 
                         return ret;
@@ -3394,7 +3389,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
         GridCacheContext cacheCtx,
         Collection<? extends K> keys,
         boolean retval,
-        CacheEntryPredicate[] filter,
+        CacheEntryPredicate filter,
         boolean singleRmv
     ) {
         return removeAllAsync0(cacheCtx, keys, null, retval, filter, singleRmv);
@@ -3415,7 +3410,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
         @Nullable final Collection<? extends K> keys,
         @Nullable Map<KeyCacheObject, GridCacheVersion> drMap,
         final boolean retval,
-        @Nullable final CacheEntryPredicate[] filter,
+        @Nullable final CacheEntryPredicate filter,
         boolean singleRmv) {
         try {
             checkUpdatesAllowed(cacheCtx);
@@ -3486,7 +3481,9 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
 
         ExpiryPolicy plc;
 
-        if (!F.isEmpty(filter))
+        final CacheEntryPredicate[] filters = CU.filterArray(filter);
+
+        if (!F.isEmpty(filters))
             plc = opCtx != null ? opCtx.expiry() : null;
         else
             plc = null;
@@ -3502,7 +3499,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
             /** invoke arguments */null,
             retval,
             /** lock only */false,
-            filter,
+            filters,
             ret,
             enlisted,
             null,
@@ -3553,12 +3550,12 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
implements Ig
                     postLockWrite(cacheCtx,
                         enlisted,
                         ret,
-                            /*remove*/true,
+                        /*remove*/true,
                         retval,
-                            /*read*/false,
+                        /*read*/false,
                         -1L,
-                        filter,
-                            /*computeInvoke*/false);
+                        filters,
+                        /*computeInvoke*/false);
 
                     return ret;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/299538b8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
index d884617..5911e89 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
@@ -141,7 +141,7 @@ public interface IgniteTxLocalEx extends IgniteInternalTx {
         GridCacheContext cacheCtx,
         Collection<? extends K> keys,
         boolean retval,
-        CacheEntryPredicate[] filter,
+        CacheEntryPredicate filter,
         boolean singleRmv);
 
     /**


Mime
View raw message