#IGNITE-53: Move implementation from IgniteCacheProxy to GridCacheAdapter.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bdff6c59 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bdff6c59 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bdff6c59 Branch: refs/heads/ignite-94 Commit: bdff6c598df00265e17747f2d063bba0e4a5e789 Parents: 11db95b Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Jan 23 10:24:19 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Jan 23 10:24:19 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/IgniteCacheProxy.java | 14 +---------- .../processors/cache/GridCacheAdapter.java | 26 +++++++++++++++++++- 2 files changed, 26 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdff6c59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index d143f75..2bad25d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -827,19 +827,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements GridCacheProjectionImpl<K, V> prev = gate.enter(prj); try { - GridCacheQueryFuture<Map.Entry<K, V>> fut = delegate.queries().createScanQuery(null) - .keepAll(false) - .execute(); - - return ctx.itHolder().iterator(fut, new CacheIteratorConverter<Entry<K, V>, Map.Entry<K, V>>() { - @Override protected Entry<K, V> convert(Map.Entry<K, V> e) { - return new CacheEntryImpl<>(e.getKey(), e.getValue()); - } - - @Override protected void remove(Entry<K, V> item) { - IgniteCacheProxy.this.remove(item.getKey()); - } - }); + return ((GridCacheAdapter)delegate).igniteIterator(); } finally { gate.leave(prev); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdff6c59/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java index 4fdfc19..e1459bf 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java @@ -22,7 +22,6 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.dataload.*; import org.apache.ignite.fs.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; @@ -52,6 +51,7 @@ import org.gridgain.grid.util.typedef.internal.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; +import javax.cache.*; import javax.cache.expiry.*; import javax.cache.processor.*; import java.io.*; @@ -3618,6 +3618,30 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, return entrySet().iterator(); } + /** + * @return Distributed ignite cache iterator. + */ + public Iterator<Cache.Entry<K, V>> igniteIterator() { + GridCacheQueryFuture<Map.Entry<K, V>> fut = queries().createScanQuery(null) + .keepAll(false) + .execute(); + + return ctx.itHolder().iterator(fut, new CacheIteratorConverter<Cache.Entry<K, V>, Map.Entry<K, V>>() { + @Override protected Cache.Entry<K, V> convert(Map.Entry<K, V> e) { + return new CacheEntryImpl<>(e.getKey(), e.getValue()); + } + + @Override protected void remove(Cache.Entry<K, V> item) { + try { + GridCacheAdapter.this.removex(item.getKey()); + } + catch (IgniteCheckedException e) { + throw new CacheException(e); + } + } + }); + } + /** {@inheritDoc} */ @Nullable @Override public V promote(K key) throws IgniteCheckedException { return promote(key, true);