Repository: incubator-ignite Updated Branches: refs/heads/ignite-611 b6955cfaf -> 95540fd1d
#ignite-611: Remove filters from GridCacheProxyImpl. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/95540fd1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/95540fd1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/95540fd1 Branch: refs/heads/ignite-611 Commit: 95540fd1da5ecc8bf09194df457e4945f940120e Parents: b6955cf Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Mar 27 13:15:59 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Mar 27 13:15:59 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheAdapter.java | 78 ----------- .../processors/cache/GridCacheProcessor.java | 4 +- .../processors/cache/GridCacheProjectionEx.java | 8 -- .../cache/GridCacheProjectionImpl.java | 140 ++++--------------- .../processors/cache/GridCacheProxyImpl.java | 5 - .../processors/cache/IgniteCacheProxy.java | 2 - .../CacheDataStructuresManager.java | 4 +- ...achePartitionedMultiNodeFullApiSelfTest.java | 54 +++---- .../hadoop/jobtracker/HadoopJobTracker.java | 3 +- 9 files changed, 63 insertions(+), 235 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/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 f40f268..5d57a4b 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 @@ -385,16 +385,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, } /** {@inheritDoc} */ - @Override public CacheEntryPredicate predicate() { - return null; - } - - /** {@inheritDoc} */ @Override public GridCacheProjectionEx<K, V> forSubjectId(UUID subjId) { GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, ctx, null, - null, subjId, false, null); @@ -409,7 +403,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, ctx, - null, EnumSet.copyOf(F.asList(flags)), null, false, @@ -441,7 +434,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, (GridCacheContext<K1, V1>)ctx, null, null, - null, true, null ); @@ -459,80 +451,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx, null, null, - null, false, plc); } - /** - * Gets cache projection only for given key and value type. Only {@code non-null} key-value - * pairs that have matching key and value pairs will be used in this projection. - * - * @param keyType Key type. - * @param valType Value type. - * @param <K1> Key type. - * @param <V1> Value type. - * @return Cache projection for given key and value types. - */ - @SuppressWarnings({"unchecked", "RedundantCast"}) - public <K1, V1> CacheProjection<K1, V1> projection( - Class<? super K1> keyType, - Class<? super V1> valType - ) { - if (ctx.deploymentEnabled()) { - try { - ctx.deploy().registerClasses(keyType, valType); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - GridCacheProjectionImpl<K1, V1> prj = new GridCacheProjectionImpl<>((CacheProjection<K1, V1>)this, - (GridCacheContext<K1, V1>)ctx, - CU.typeFilter0(keyType, valType), - /*flags*/null, - /*clientId*/null, - false, - null); - - return new GridCacheProxyImpl<>((GridCacheContext<K1, V1>)ctx, prj, prj); - } - - /** - * Gets cache projection based on given entry filter. This filter will be simply passed through - * to all cache operations on this projection. Unlike <code>projection(org.apache.ignite.lang.IgniteBiPredicate)</code> - * method, this filter will <b>not</b> be used for pre-filtering. - * - * @param filter Filter to be passed through to all cache operations. If {@code null}, then the - * same projection is returned. If cache operation receives its own filter, then filters - * will be {@code 'anded'}. - * @return Projection based on given filter. - */ - public CacheProjection<K, V> projection(CacheEntryPredicate filter) { - if (filter == null) - return this; - - if (ctx.deploymentEnabled()) { - try { - ctx.deploy().registerClasses(filter); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>( - this, - ctx, - filter, - null, - null, - false, - null); - - return new GridCacheProxyImpl<>(ctx, prj, prj); - } /** {@inheritDoc} */ @Override public CacheConfiguration configuration() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index 8dfa08a..e17ad54 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -2189,9 +2189,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @return Projection over utility cache. */ public <K extends GridCacheUtilityKey, V> GridCacheProjectionEx<K, V> utilityCache(Class<K> keyCls, Class<V> valCls) { - GridCacheAdapter<K, V> cache = internalCache(CU.UTILITY_CACHE_NAME); + GridCache<K, V> cache = cache(CU.UTILITY_CACHE_NAME); - return (GridCacheProjectionEx<K, V>)cache.projection(keyCls, valCls); + return (GridCacheProjectionEx<K, V>)cache; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java index d8574b7..048f026 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java @@ -44,14 +44,6 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> { GridCacheProjectionEx<K, V> forSubjectId(UUID subjId); /** - * Gets predicate on which this projection is based on or {@code null} - * if predicate is not defined. - * - * @return Filter on which this projection is based on. - */ - @Nullable public CacheEntryPredicate predicate(); - - /** * Internal method that is called from {@link CacheEntryImpl}. * * @param key Key. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/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 1300fb6..fdf59ef 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 @@ -22,11 +22,9 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.dr.*; -import org.apache.ignite.internal.processors.cache.local.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; @@ -52,10 +50,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** */ private static final long serialVersionUID = 0L; - /** Entry filter. */ - @GridToStringExclude - private CacheEntryPredicate filter; - /** Base cache. */ private GridCacheAdapter<K, V> cache; @@ -88,14 +82,12 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** * @param parent Parent projection. * @param cctx Cache context. - * @param entryFilter Entry filter. * @param flags Flags for new projection */ @SuppressWarnings({"unchecked", "TypeMayBeWeakened"}) public GridCacheProjectionImpl( CacheProjection<K, V> parent, GridCacheContext<K, V> cctx, - @Nullable CacheEntryPredicate entryFilter, @Nullable Set<CacheFlag> flags, @Nullable UUID subjId, boolean keepPortable, @@ -114,8 +106,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V this.flags = Collections.unmodifiableSet(f); - this.filter = entryFilter; - this.subjId = subjId; cache = cctx.cache(); @@ -151,58 +141,12 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V } /** - * {@code Ands} passed in filter with projection filter. - * - * @param filter filter to {@code and}. - * @return {@code Anded} filter array. - */ - CacheEntryPredicate and(CacheEntryPredicate filter) { - CacheEntryPredicate entryFilter = this.filter; - - if (filter == null) - return entryFilter; - - return F0.and0(entryFilter, filter); - } - - /** - * {@code Ands} two passed in filters. - * - * @param f1 First filter. - * @return {@code Anded} filter. - */ - private CacheEntryPredicate and(@Nullable final CacheEntryPredicate[] f1) { - CacheEntryPredicate entryFilter = filter; - - if (F.isEmpty(f1)) - return entryFilter; - - return F0.and0(entryFilter, f1); - } - - /** * @param k Key. * @param v Value. * @return {@code True} if filter passed. */ boolean isAll(K k, V v) { - if (k == null || v == null) - return false; - - if (filter != null) { - GridLocalCacheEntry e = new GridLocalCacheEntry(cctx, - cctx.toCacheKeyObject(k), - k.hashCode(), - cctx.toCacheObject(v), - null, - 0, - 0); - - if (!filter.apply(e)) - return false; - } - - return true; + return !(k == null || v == null); } /** @@ -260,7 +204,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, cctx, - filter, flags, subjId, keepPortable, @@ -293,7 +236,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, cctx, - filter, res, subjId, keepPortable, @@ -316,7 +258,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, cctx, - filter, res, subjId, keepPortable, @@ -330,7 +271,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V GridCacheProjectionImpl<K1, V1> prj = new GridCacheProjectionImpl<>( (CacheProjection<K1, V1>)this, (GridCacheContext<K1, V1>)cctx, - filter, flags, subjId, true, @@ -372,7 +312,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public int nearSize() { return cctx.config().getCacheMode() == PARTITIONED && isNearEnabled(cctx) ? - cctx.near().nearKeySet(filter).size() : 0; + cctx.near().nearKeySet(null).size() : 0; } /** {@inheritDoc} */ @@ -428,7 +368,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public V get(K key, @Nullable GridCacheEntryEx entry, boolean deserializePortable, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException { - return cache.get(key, entry, deserializePortable, and(filter)); + return cache.get(key, entry, deserializePortable, filter); } /** {@inheritDoc} */ @@ -518,7 +458,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V if (!isAll(key, val)) return new GridFinishedFuture<>(); - return cache.putAsync(key, val, entry, ttl, and(filter)); + return cache.putAsync(key, val, entry, ttl, filter); } /** {@inheritDoc} */ @@ -600,7 +540,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V if (!isAll(key, val)) return new GridFinishedFuture<>(false); - return cache.putxAsync(key, val, entry, ttl, and(filter)); + return cache.putxAsync(key, val, entry, ttl, filter); } /** {@inheritDoc} */ @@ -650,7 +590,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) { - CacheEntryPredicate fltr = this.filter != null ? and(cctx.equalsValArray(oldVal)) : cctx.equalsValue(oldVal); + CacheEntryPredicate fltr = cctx.equalsValue(oldVal); return cache.putxAsync(key, newVal, fltr); } @@ -669,12 +609,12 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V if (F.isEmpty(m)) return new GridFinishedFuture<>(); - return cache.putAllAsync(m, and(filter)); + return cache.putAllAsync(m, filter); } /** {@inheritDoc} */ @Override public Set<K> keySet() { - return cache.keySet(filter); + return cache.keySet(); } /** {@inheritDoc} */ @@ -684,32 +624,32 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public Set<K> primaryKeySet() { - return cache.primaryKeySet(filter); + return cache.primaryKeySet(); } /** {@inheritDoc} */ @Override public Collection<V> values() { - return cache.values(filter); + return cache.values(); } /** {@inheritDoc} */ @Override public Collection<V> primaryValues() { - return cache.primaryValues(filter); + return cache.primaryValues(); } /** {@inheritDoc} */ @Override public Set<Cache.Entry<K, V>> entrySet() { - return cache.entrySet(filter); + return cache.entrySet(); } /** {@inheritDoc} */ @Override public Set<Cache.Entry<K, V>> entrySetx(CacheEntryPredicate... filter) { - return cache.entrySetx(F0.and0(filter, this.filter)); + return cache.entrySetx(filter); } /** {@inheritDoc} */ @Override public Set<Cache.Entry<K, V>> primaryEntrySetx(CacheEntryPredicate... filter) { - return cache.primaryEntrySetx(F0.and0(filter, this.filter)); + return cache.primaryEntrySetx(filter); } /** {@inheritDoc} */ @@ -720,7 +660,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public Set<Cache.Entry<K, V>> primaryEntrySet() { - return cache.primaryEntrySet(filter); + return cache.primaryEntrySet(); } /** {@inheritDoc} */ @@ -740,11 +680,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V } /** {@inheritDoc} */ - @Override public CacheEntryPredicate predicate() { - return filter; - } - - /** {@inheritDoc} */ @Override public String name() { return cache.name(); } @@ -756,7 +691,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public V peek(K key) { - return cache.peek(key, filter); + return cache.peek(key); } /** {@inheritDoc} */ @@ -792,18 +727,12 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public boolean evict(K key) { - if (predicate() != null) - return cache.evict(key, filter); - else - return cache.evict(key); + return cache.evict(key); } /** {@inheritDoc} */ @Override public void evictAll(@Nullable Collection<? extends K> keys) { - if (predicate() != null) - cache.evictAll(keys, filter); - else - cache.evictAll(keys); + cache.evictAll(keys); } /** {@inheritDoc} */ @@ -858,7 +787,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public boolean clearLocally(K key) { - return cache.clearLocally0(key, filter); + return cache.clearLocally0(key); } /** {@inheritDoc} */ @@ -881,7 +810,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx entry, @Nullable CacheEntryPredicate... filter) { - return cache.removeAsync(key, entry, and(filter)); + return cache.removeAsync(key, entry, filter); } /** {@inheritDoc} */ @@ -916,7 +845,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx entry, @Nullable CacheEntryPredicate... filter) { - return cache.removexAsync(key, entry, and(filter)); + return cache.removexAsync(key, entry, filter); } /** {@inheritDoc} */ @@ -960,13 +889,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, and(filter)); + cache.removeAll(keys, filter); } /** {@inheritDoc} */ @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys, @Nullable CacheEntryPredicate[] filter) { - return cache.removeAllAsync(keys, and(filter)); + return cache.removeAllAsync(keys, filter); } /** {@inheritDoc} */ @@ -977,49 +906,47 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public IgniteInternalFuture<?> removeAllAsync() { - assert predicate() == null; - return cache.removeAllAsync(); } /** {@inheritDoc} */ @Override public void localRemoveAll() throws IgniteCheckedException { - cache.localRemoveAll(predicate()); + cache.localRemoveAll(); } /** {@inheritDoc} */ @Override public boolean lock(K key, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException { - return cache.lock(key, timeout, and(filter)); + return cache.lock(key, timeout, filter); } /** {@inheritDoc} */ @Override public IgniteInternalFuture<Boolean> lockAsync(K key, long timeout, @Nullable CacheEntryPredicate[] filter) { - return cache.lockAsync(key, timeout, and(filter)); + return cache.lockAsync(key, timeout, filter); } /** {@inheritDoc} */ @Override public boolean lockAll(@Nullable Collection<? extends K> keys, long timeout, @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException { - return cache.lockAll(keys, timeout, and(filter)); + return cache.lockAll(keys, timeout, filter); } /** {@inheritDoc} */ @Override public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection<? extends K> keys, long timeout, @Nullable CacheEntryPredicate[] filter) { - return cache.lockAllAsync(keys, timeout, and(filter)); + return cache.lockAllAsync(keys, timeout, filter); } /** {@inheritDoc} */ @Override public void unlock(K key, CacheEntryPredicate[] filter) throws IgniteCheckedException { - cache.unlock(key, and(filter)); + cache.unlock(key, filter); } /** {@inheritDoc} */ @Override public void unlockAll(@Nullable Collection<? extends K> keys, @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException { - cache.unlockAll(keys, and(filter)); + cache.unlockAll(keys, filter); } /** {@inheritDoc} */ @@ -1075,7 +1002,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V /** {@inheritDoc} */ @Override public Iterator<Cache.Entry<K, V>> iterator() { - return cache.entrySet(filter).iterator(); + return cache.entrySet().iterator(); } /** {@inheritDoc} */ @@ -1099,7 +1026,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V return new GridCacheProjectionImpl<>( this, cctx, - filter, flags, subjId, true, @@ -1110,8 +1036,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(cctx); - out.writeObject(filter); - U.writeCollection(out, flags); out.writeBoolean(keepPortable); @@ -1122,8 +1046,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { cctx = (GridCacheContext<K, V>)in.readObject(); - filter = (CacheEntryPredicate)in.readObject(); - flags = U.readSet(in); cache = cctx.cache(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/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 239c006..47aa91f 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 @@ -297,11 +297,6 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali } /** {@inheritDoc} */ - @Override public CacheEntryPredicate predicate() { - return delegate.predicate(); - } - - /** {@inheritDoc} */ @Override public GridCacheProjectionEx<K, V> forSubjectId(UUID subjId) { return delegate.forSubjectId(subjId); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/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 2b297ef..e5cef6c 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 @@ -1384,7 +1384,6 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V GridCacheProjectionImpl<K1, V1> prj0 = new GridCacheProjectionImpl<>( (CacheProjection<K1, V1>)(prj != null ? prj : delegate), (GridCacheContext<K1, V1>)ctx, - null, prj != null ? prj.flags() : null, prj != null ? prj.subjectId() : null, true, @@ -1426,7 +1425,6 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V GridCacheProjectionImpl<K, V> prj0 = new GridCacheProjectionImpl<>( (prj != null ? prj : delegate), ctx, - null, res, prj != null ? prj.subjectId() : null, true, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java index 2de56b5..ac48b03 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java @@ -56,7 +56,7 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter { private final ConcurrentMap<IgniteUuid, GridCacheQueueProxy> queuesMap; /** Queue header view. */ - private CacheProjection<GridCacheQueueHeaderKey, GridCacheQueueHeader> queueHdrView; + private GridCache<GridCacheQueueHeaderKey, GridCacheQueueHeader> queueHdrView; /** Query notifying about queue update. */ private UUID queueQryId; @@ -85,7 +85,7 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter { /** {@inheritDoc} */ @Override protected void onKernalStart0() throws IgniteCheckedException { try { - queueHdrView = cctx.cache().projection(GridCacheQueueHeaderKey.class, GridCacheQueueHeader.class); + queueHdrView = cctx.grid().cachex(cctx.name()); initFlag = true; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java index 5b78469..8d9e892 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.near; import org.apache.ignite.*; +import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; @@ -25,9 +26,9 @@ import org.apache.ignite.events.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import javax.cache.*; import java.util.*; import java.util.concurrent.atomic.*; @@ -298,7 +299,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti info("Generating keys for test..."); - GridCacheAdapter<String, Integer> cache0 = ((IgniteKernal)grid(0)).internalCache(); + IgniteCache<String, Integer> cache0 = jcache(0); for (int i = 0; i < 5; i++) { while (true) { @@ -317,43 +318,42 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti info("Finished generating keys for test."); - GridCacheAdapter<String, Integer> cache2 = ((IgniteKernal)grid(2)).internalCache(); + IgniteCache<String, Integer> cache2 = jcache(2); assertEquals(Integer.valueOf(0), cache2.get(keys.get(0))); assertEquals(Integer.valueOf(1), cache2.get(keys.get(1))); - assertEquals(0, cache0.nearSize()); - assertEquals(5, cache0.size() - cache0.nearSize()); + assertEquals(0, cache0.localSize(NEAR)); + assertEquals(5, cache0.localSize() - cache0.localSize(NEAR)); - GridCacheAdapter<String, Integer> cache1 = ((IgniteKernal)grid(1)).internalCache(); + IgniteCache<String, Integer> cache1 = jcache(1); - assertEquals(0, cache1.nearSize()); - assertEquals(5, cache1.size() - cache1.nearSize()); + assertEquals(0, cache1.localSize(NEAR)); + assertEquals(5, cache1.localSize() - cache1.localSize(NEAR)); - assertEquals(nearEnabled() ? 2 : 0, cache2.nearSize()); - assertEquals(0, cache2.size() - cache2.nearSize()); + assertEquals(nearEnabled() ? 2 : 0, cache2.localSize(NEAR)); + assertEquals(0, cache2.localSize() - cache2.localSize(NEAR)); - CacheEntryPredicate prjFilter = new CacheEntryPredicateAdapter() { - @Override public boolean apply(GridCacheEntryEx e) { - try { - Integer val = CU.value(e.rawGetOrUnmarshal(false), e.context(), false); - return val != null && val >= 1 && val <= 3; - } - catch (IgniteCheckedException err) { - throw new IgniteException(err); - } - } - }; + assertEquals(0, projectionSize(cache0, NEAR)); + assertEquals(3, projectionSize(cache0) - projectionSize(cache0, NEAR)); - assertEquals(0, cache0.projection(prjFilter).nearSize()); - assertEquals(3, cache0.projection(prjFilter).size() - cache0.projection(prjFilter).nearSize()); + assertEquals(0, projectionSize(cache1, NEAR)); + assertEquals(3, projectionSize(cache1) - projectionSize(cache1, NEAR)); - assertEquals(0, cache1.projection(prjFilter).nearSize()); - assertEquals(3, cache1.projection(prjFilter).size() - cache1.projection(prjFilter).nearSize()); + assertEquals(nearEnabled() ? 1 : 0, projectionSize(cache2, NEAR)); + assertEquals(0, projectionSize(cache2) - projectionSize(cache2, NEAR)); + } + + private int projectionSize(IgniteCache<String, Integer> cache, CachePeekMode... modes) { + int size = 0; + + for (Cache.Entry<String, Integer> e : cache.localEntries(modes)) { + if (e.getValue() != null && e.getValue() >= 1 && e.getValue() <= 3) + size++; + } - assertEquals(nearEnabled() ? 1 : 0, cache2.projection(prjFilter).nearSize()); - assertEquals(0, cache2.projection(prjFilter).size() - cache2.projection(prjFilter).nearSize()); + return size; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/95540fd1/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java index a420f23..433b84f 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java @@ -129,8 +129,7 @@ public class HadoopJobTracker extends HadoopComponent { throw new IllegalStateException(e); } - jobMetaPrj = prj = (GridCacheProjectionEx<HadoopJobId, HadoopJobMetadata>) - sysCache.projection(HadoopJobId.class, HadoopJobMetadata.class); + jobMetaPrj = prj = sysCache; if (ctx.configuration().getFinishedJobInfoTtl() > 0) { ExpiryPolicy finishedJobPlc = new ModifiedExpiryPolicy(