You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/09 15:53:01 UTC
[6/6] incubator-ignite git commit: #ignite-683: Remove all methods
with filters from CacheProjection.
#ignite-683: Remove all methods with filters from CacheProjection.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d6ae9036
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d6ae9036
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d6ae9036
Branch: refs/heads/ignite-683-1
Commit: d6ae9036ddd3f2c14c3c01bd73752c236eb11161
Parents: 064bcd8
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Apr 9 16:52:46 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Apr 9 16:52:46 2015 +0300
----------------------------------------------------------------------
.../processors/cache/CacheProjection.java | 24 ++++--------------
.../processors/cache/GridCacheAdapter.java | 26 ++++++++++++++------
.../cache/GridCacheProjectionImpl.java | 26 +++++++++-----------
.../processors/cache/GridCacheProxyImpl.java | 23 ++++++++---------
.../dht/atomic/GridDhtAtomicCache.java | 2 +-
.../local/atomic/GridLocalAtomicCache.java | 2 +-
.../GridAtomicCacheQueueImpl.java | 4 +--
7 files changed, 48 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/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 f3215d1..31dab7e 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
@@ -1180,12 +1180,10 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
* if there is one.
*
* @param key Key whose mapping is to be removed from cache.
- * @param filter Optional filter to check prior to removing value form cache. Note
- * that filter is checked atomically together with remove operation.
* @return Future for the remove operation.
* @throws NullPointerException if the key is {@code null}.
*/
- public IgniteInternalFuture<V> removeAsync(K key, CacheEntryPredicate... filter);
+ public IgniteInternalFuture<V> removeAsync(K key);
/**
* Removes given key mapping from cache.
@@ -1200,15 +1198,12 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
* if there is one.
*
* @param key Key whose mapping is to be removed from cache.
- * @param filter Optional filter to check prior to removing value form cache. Note
- * that filter is checked atomically together with remove operation.
* @return {@code True} if filter passed validation and entry was removed, {@code false} otherwise.
* Note that if filter is not specified, this method will return {@code true}.
* @throws NullPointerException if the key is {@code null}.
* @throws IgniteCheckedException If remove failed.
*/
- public boolean removex(K key, @Nullable CacheEntryPredicate... filter)
- throws IgniteCheckedException;
+ public boolean removex(K key) throws IgniteCheckedException;
/**
* Asynchronously removes given key mapping from cache.
@@ -1223,15 +1218,12 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
* if there is one.
*
* @param key Key whose mapping is to be removed from cache.
- * @param filter Optional filter to check prior to removing value form cache. Note
- * that filter is checked atomically together with remove operation.
* @return Future for the remove operation. The future will return {@code true}
* if optional filters passed validation and remove did occur, {@code false} otherwise.
* Note that if filter is not specified, this method will return {@code true}.
* @throws NullPointerException if the key is {@code null}.
*/
- public IgniteInternalFuture<Boolean> removexAsync(K key,
- @Nullable CacheEntryPredicate... filter);
+ public IgniteInternalFuture<Boolean> removexAsync(K key);
/**
* Removes given key mapping from cache if one exists and value is equal to the passed in value.
@@ -1282,12 +1274,9 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
* if there is one.
*
* @param keys Keys whose mappings are to be removed from cache.
- * @param filter Optional filter to check prior to removing value form cache. Note
- * that filter is checked atomically together with remove operation.
* @throws IgniteCheckedException If remove failed.
*/
- public void removeAll(@Nullable Collection<? extends K> keys,
- @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException;
+ public void removeAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException;
/**
* Asynchronously removes given key mappings from cache for entries for which the optionally
@@ -1300,13 +1289,10 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
* if there is one.
*
* @param keys Keys whose mappings are to be removed from cache.
- * @param filter Optional filter to check prior to removing value form cache. Note
- * that filter is checked atomically together with remove operation.
* @return Future for the remove operation. The future will complete whenever
* remove operation completes.
*/
- public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys,
- @Nullable CacheEntryPredicate... filter);
+ public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys);
/**
* Removes mappings from cache for entries for which the optionally passed in filters do
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/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 8019940..6a97777 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
@@ -2844,12 +2844,12 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<V> removeAsync(K key, CacheEntryPredicate... filter) {
+ @Override public IgniteInternalFuture<V> removeAsync(K key) {
final boolean statsEnabled = ctx.config().isStatisticsEnabled();
final long start = statsEnabled ? System.nanoTime() : 0L;
- IgniteInternalFuture<V> fut = removeAsync0(key, filter);
+ IgniteInternalFuture<V> fut = removeAsync0(key, CU.empty0());
if (statsEnabled)
fut.listen(new UpdateRemoveTimeStatClosure<V>(metrics0(), start));
@@ -2894,7 +2894,12 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/** {@inheritDoc} */
- @Override public void removeAll(final Collection<? extends K> keys,
+ @Override public void removeAll(final Collection<? extends K> keys) throws IgniteCheckedException {
+ removeAll(keys, CU.empty0());
+ }
+
+ /** */
+ public void removeAll(final Collection<? extends K> keys,
final CacheEntryPredicate... filter) throws IgniteCheckedException {
boolean statsEnabled = ctx.config().isStatisticsEnabled();
@@ -2923,7 +2928,12 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable final Collection<? extends K> keys,
+ @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable final Collection<? extends K> keys) {
+ return removeAllAsync(keys, CU.empty0());
+ }
+
+ /** {@inheritDoc} */
+ public IgniteInternalFuture<?> removeAllAsync(@Nullable final Collection<? extends K> keys,
final CacheEntryPredicate... filter) {
final boolean statsEnabled = ctx.config().isStatisticsEnabled();
@@ -2952,13 +2962,13 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/** {@inheritDoc} */
- @Override public boolean removex(final K key, final CacheEntryPredicate... filter)
+ @Override public boolean removex(final K key)
throws IgniteCheckedException {
boolean statsEnabled = ctx.config().isStatisticsEnabled();
long start = statsEnabled ? System.nanoTime() : 0L;
- boolean rmv = removex0(key, filter);
+ boolean rmv = removex0(key, CU.empty0());
if (statsEnabled && rmv)
metrics0().addRemoveTimeNanos(System.nanoTime() - start);
@@ -3002,10 +3012,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<Boolean> removexAsync(K key, CacheEntryPredicate... filter) {
+ @Override public IgniteInternalFuture<Boolean> removexAsync(K key) {
A.notNull(key, "key");
- return removexAsync0(key, filter);
+ return removexAsync0(key, CU.empty0());
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/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 3fe2857..ca19446 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
@@ -623,18 +623,17 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
/** {@inheritDoc} */
@Override public V remove(K key) throws IgniteCheckedException {
- return removeAsync(key, CU.empty0()).get();
+ return removeAsync(key).get();
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<V> removeAsync(K key, CacheEntryPredicate[] filter) {
- return cache.removeAsync0(key, filter);
+ @Override public IgniteInternalFuture<V> removeAsync(K key) {
+ return cache.removeAsync0(key, CU.empty0());
}
/** {@inheritDoc} */
- @Override public boolean removex(K key,
- @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
- return removexAsync(key, filter).get();
+ @Override public boolean removex(K key) throws IgniteCheckedException {
+ return removexAsync(key).get();
}
/** {@inheritDoc} */
@@ -649,9 +648,8 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<Boolean> removexAsync(K key,
- @Nullable CacheEntryPredicate[] filter) {
- return cache.removexAsync0(key, filter);
+ @Override public IgniteInternalFuture<Boolean> removexAsync(K key) {
+ return cache.removexAsync0(key);
}
/** {@inheritDoc} */
@@ -687,15 +685,13 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
}
/** {@inheritDoc} */
- @Override public void removeAll(@Nullable Collection<? extends K> keys,
- @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException {
- cache.removeAll(keys, filter);
+ @Override public void removeAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException {
+ cache.removeAll(keys);
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys,
- @Nullable CacheEntryPredicate[] filter) {
- return cache.removeAllAsync(keys, filter);
+ @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys) {
+ return cache.removeAllAsync(keys);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/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 4615ee8..5df6964 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
@@ -1248,11 +1248,11 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<V> removeAsync(K key, CacheEntryPredicate[] filter) {
+ @Override public IgniteInternalFuture<V> removeAsync(K key) {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- return delegate.removeAsync(key, filter);
+ return delegate.removeAsync(key);
}
finally {
gate.leave(prev);
@@ -1260,12 +1260,12 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Override public boolean removex(K key, @Nullable CacheEntryPredicate[] filter)
+ @Override public boolean removex(K key)
throws IgniteCheckedException {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- return delegate.removex(key, filter);
+ return delegate.removex(key);
}
finally {
gate.leave(prev);
@@ -1300,12 +1300,11 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<Boolean> removexAsync(K key,
- @Nullable CacheEntryPredicate[] filter) {
+ @Override public IgniteInternalFuture<Boolean> removexAsync(K key) {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- return delegate.removexAsync(key, filter);
+ return delegate.removexAsync(key);
}
finally {
gate.leave(prev);
@@ -1385,12 +1384,11 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Override public void removeAll(@Nullable Collection<? extends K> keys,
- @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
+ @Override public void removeAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- delegate.removeAll(keys, filter);
+ delegate.removeAll(keys);
}
finally {
gate.leave(prev);
@@ -1398,12 +1396,11 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys,
- @Nullable CacheEntryPredicate[] filter) {
+ @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys) {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- return delegate.removeAllAsync(keys, filter);
+ return delegate.removeAllAsync(keys);
}
finally {
gate.leave(prev);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/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 026a4f6..8b4c738 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
@@ -545,7 +545,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Override public IgniteInternalFuture<Boolean> removeAsync(K key, V val) {
A.notNull(key, "key", val, "val");
- return removexAsync(key, ctx.equalsValArray(val));
+ return removexAsync0(key, ctx.equalsValArray(val));
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/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 fa7fb72..4c002d8 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
@@ -408,7 +408,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
/** {@inheritDoc} */
@Override public IgniteInternalFuture<Boolean> removeAsync(K key, V val) {
- return removexAsync(key, ctx.equalsValArray(val));
+ return removexAsync0(key, ctx.equalsValArray(val));
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ae9036/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
index 70e72a2..83f646c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
@@ -199,14 +199,14 @@ public class GridAtomicCacheQueueImpl<T> extends GridCacheQueueAdapter<T> {
while (true) {
try {
- if (cache.removex(key, null))
+ if (cache.removex(key))
return;
if (stop == 0)
stop = U.currentTimeMillis() + RETRY_TIMEOUT;
while (U.currentTimeMillis() < stop ) {
- if (cache.removex(key, null))
+ if (cache.removex(key))
return;
}