# IGNITE-54-55 Use DataLoader to remove keys.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e5b41cc8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e5b41cc8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e5b41cc8 Branch: refs/heads/ignite-111 Commit: e5b41cc82b0b058ef2254a2471d814b16e4196ec Parents: 572c372 Author: sevdokimov <sevdoki...@gridgain.com> Authored: Thu Feb 5 17:04:17 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Thu Feb 5 17:04:17 2015 +0300 ---------------------------------------------------------------------- .../distributed/GridDistributedCacheAdapter.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5b41cc8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java index 277d8cc..785d455 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java @@ -175,9 +175,6 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter @GridInternal private static class GlobalRemoveAllCallable<K,V> implements Callable<Object>, Externalizable { /** */ - private static final long REMOVE_ALL_BATCH_SIZE = 100L; - - /** */ private static final long serialVersionUID = 0L; /** Cache name. */ @@ -226,24 +223,16 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter GridDhtCacheAdapter<K, V> dht = (GridDhtCacheAdapter<K, V>)cacheAdapter; - Collection<K> keys = new ArrayList<>(); + IgniteDataLoader<K, V> dataLdr = grid.dataLoader(cacheName); for (GridDhtLocalPartition<K, V> locPart : dht.topology().currentLocalPartitions()) { if (!locPart.isEmpty() && locPart.primary(topVer)) { - for (GridDhtCacheEntry<K, V> o : locPart.entries()) { - keys.add(o.key()); - - if (keys.size() >= REMOVE_ALL_BATCH_SIZE) { - cache.removeAll(keys); - - keys.clear(); - } - } + for (GridDhtCacheEntry<K, V> o : locPart.entries()) + dataLdr.removeData(o.key()); } } - if (!keys.isEmpty()) - cache.removeAll(keys); + dataLdr.close(); return null; }