Removed unused IgniteInternalCache methods.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/330d9ef2 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/330d9ef2 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/330d9ef2 Branch: refs/heads/ignite-5075-cacheStart Commit: 330d9ef26946541ae95a7221c1a2f02daf167812 Parents: 865eed7 Author: sboikov <[email protected]> Authored: Mon May 15 13:10:57 2017 +0300 Committer: sboikov <[email protected]> Committed: Mon May 15 13:10:57 2017 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheAdapter.java | 71 +------- .../cache/GridCacheConcurrentMap.java | 5 - .../cache/GridCacheConcurrentMapImpl.java | 28 ---- .../processors/cache/GridCacheProxyImpl.java | 60 ------- .../processors/cache/GridNoStorageCacheMap.java | 5 - .../processors/cache/IgniteInternalCache.java | 61 ------- .../dht/GridCachePartitionedConcurrentMap.java | 9 -- .../distributed/dht/GridDhtCacheAdapter.java | 162 ------------------- .../distributed/near/GridNearCacheAdapter.java | 17 -- .../GridCachePartitionedFullApiSelfTest.java | 18 --- .../cache/eviction/EvictionAbstractTest.java | 13 +- .../hadoop/jobtracker/HadoopJobTracker.java | 20 ++- .../cache/hibernate/HibernateCacheProxy.java | 25 --- 13 files changed, 28 insertions(+), 466 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/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 694f4b0..0ad383b 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 @@ -991,78 +991,11 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V return entrySet((CacheEntryPredicate[])null); } - /** - * Gets entry set containing internal entries. - * - * @param filter Filter. - * @return Entry set. - */ - @Override public final Set<Cache.Entry<K, V>> entrySetx(final CacheEntryPredicate... filter) { - boolean keepBinary = ctx.keepBinary(); - - return new EntrySet(map.entrySet(filter), keepBinary); - } - - /** {@inheritDoc} */ - @Override public Set<Cache.Entry<K, V>> entrySet(int part) { - throw new UnsupportedOperationException(); - } - /** {@inheritDoc} */ @Override public final Set<K> keySet() { return new KeySet(map.entrySet()); } - /** {@inheritDoc} */ - @Override public final Set<K> keySetx() { - return keySet(); - } - - /** {@inheritDoc} */ - @Override public final Set<K> primaryKeySet() { - return new KeySet(map.entrySet(CU.cachePrimary(ctx.grid().affinity(ctx.name()), ctx.localNode()))); - } - - /** {@inheritDoc} */ - @Override public Iterable<V> values() { - return values((CacheEntryPredicate[])null); - } - - /** - * Collection of values cached on this node. You cannot modify this collection. - * <p> - * Iterator over this collection will not fail if collection was - * concurrently updated by another thread. This means that iterator may or - * may not return latest values depending on whether they were added before - * or after current iterator position. - * <p> - * NOTE: this operation is not distributed and returns only the values cached on this node. - * - * @param filter Filters. - * @return Collection of cached values. - */ - public final Iterable<V> values(final CacheEntryPredicate... filter) { - return new Iterable<V>() { - @Override public Iterator<V> iterator() { - return new Iterator<V>() { - private final Iterator<? extends GridCacheEntryEx> it = entries().iterator(); - - @Override public boolean hasNext() { - return it.hasNext(); - } - - @Override public V next() { - return (V)it.next().wrap().getValue(); - } - - @Override public void remove() { - throw new UnsupportedOperationException("remove"); - } - }; - } - }; - } - /** * * @param key Entry key. @@ -4491,7 +4424,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V * @return Entry set. */ public Set<Cache.Entry<K, V>> entrySet(@Nullable CacheEntryPredicate... filter) { - return entrySetx(filter); + boolean keepBinary = ctx.keepBinary(); + + return new EntrySet(map.entrySet(filter), keepBinary); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java index 0fe5c9f..eb3f28e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java @@ -89,11 +89,6 @@ public interface GridCacheConcurrentMap { public void decrementPublicSize(GridCacheEntryEx e); /** - * @return Random entry out of hash map. - */ - public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter); - - /** * @param filter Filter. * @return Iterable of the mappings contained in this map, excluding entries in unvisitable state. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java index 2c262df..45b455c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java @@ -292,34 +292,6 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM } /** {@inheritDoc} */ - @Override public Set<KeyCacheObject> keySet(final CacheEntryPredicate... filter) { - final IgnitePredicate<KeyCacheObject> p = new IgnitePredicate<KeyCacheObject>() { - @Override public boolean apply(KeyCacheObject key) { - GridCacheMapEntry entry = map.get(key); - - return entry != null && entry.visitable(filter); - } - }; - - return new AbstractSet<KeyCacheObject>() { - @Override public Iterator<KeyCacheObject> iterator() { - return F.iterator0(map.keySet(), true, p); - } - - @Override public int size() { - return F.size(iterator()); - } - - @Override public boolean contains(Object o) { - if (!(o instanceof KeyCacheObject)) - return false; - - return map.keySet().contains(o) && p.apply((KeyCacheObject)o); - } - }; - } - - /** {@inheritDoc} */ @Override public Collection<GridCacheMapEntry> entries(final CacheEntryPredicate... filter) { final IgnitePredicate<GridCacheMapEntry> p = new IgnitePredicate<GridCacheMapEntry>() { @Override public boolean apply(GridCacheMapEntry entry) { http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/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 837c22a..d81b9f7 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 @@ -844,42 +844,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte } /** {@inheritDoc} */ - @Override public Set<K> keySetx() { - CacheOperationContext prev = gate.enter(opCtx); - - try { - return delegate.keySetx(); - } - finally { - gate.leave(prev); - } - } - - /** {@inheritDoc} */ - @Override public Set<K> primaryKeySet() { - CacheOperationContext prev = gate.enter(opCtx); - - try { - return delegate.primaryKeySet(); - } - finally { - gate.leave(prev); - } - } - - /** {@inheritDoc} */ - @Override public Iterable<V> values() { - CacheOperationContext prev = gate.enter(opCtx); - - try { - return delegate.values(); - } - finally { - gate.leave(prev); - } - } - - /** {@inheritDoc} */ @Override public Set<Cache.Entry<K, V>> entrySet() { CacheOperationContext prev = gate.enter(opCtx); @@ -892,30 +856,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte } /** {@inheritDoc} */ - @Override public Set<Cache.Entry<K, V>> entrySet(int part) { - CacheOperationContext prev = gate.enter(opCtx); - - try { - return delegate.entrySet(part); - } - finally { - gate.leave(prev); - } - } - - /** {@inheritDoc} */ - @Override public Set<Cache.Entry<K, V>> entrySetx(CacheEntryPredicate... filter) { - CacheOperationContext prev = gate.enter(opCtx); - - try { - return delegate.entrySetx(filter); - } - finally { - gate.leave(prev); - } - } - - /** {@inheritDoc} */ @Override public Iterator<Cache.Entry<K, V>> scanIterator(boolean keepBinary, @Nullable IgniteBiPredicate<Object, Object> p) throws IgniteCheckedException { CacheOperationContext prev = gate.enter(opCtx); http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java index 14a8482..86a573b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java @@ -81,11 +81,6 @@ public class GridNoStorageCacheMap implements GridCacheConcurrentMap { } /** {@inheritDoc} */ - @Override public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter) { - return Collections.emptySet(); - } - - /** {@inheritDoc} */ @Override public Iterable<GridCacheMapEntry> entries(CacheEntryPredicate... filter) { return Collections.emptySet(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java index cc7fd3a..2f4a40e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java @@ -46,7 +46,6 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo; -import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.lang.IgniteBiPredicate; @@ -878,46 +877,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> { public Set<K> keySet(); /** - * @return Set of keys including internal keys. - */ - public Set<K> keySetx(); - - /** - * Set of keys for which this node is primary. - * This set is dynamic and may change with grid topology changes. - * Note that this set will contain mappings for all keys, even if their values are - * {@code null} because they were invalidated. You can remove elements from - * this set, but you cannot add elements to this set. All removal operation will be - * reflected on the cache itself. - * <p> - * Iterator over this set will not fail if set was concurrently updated - * by another thread. This means that iterator may or may not return latest - * keys depending on whether they were added before or after current - * iterator position. - * <p> - * NOTE: this operation is not distributed and returns only the keys cached on this node. - * - * @return Primary key set for the current node. - */ - public Set<K> primaryKeySet(); - - /** - * Collection of values cached on this node. You can remove - * elements from this collection, but you cannot add elements to this collection. - * All removal operation will be reflected on the cache itself. - * <p> - * Iterator over this collection will not fail if collection was - * concurrently updated by another thread. This means that iterator may or - * may not return latest values depending on whether they were added before - * or after current iterator position. - * <p> - * NOTE: this operation is not distributed and returns only the values cached on this node. - * - * @return Collection of cached values. - */ - public Iterable<V> values(); - - /** * Gets set of all entries cached on this node. You can remove * elements from this set, but you cannot add elements to this set. * All removal operation will be reflected on the cache itself. @@ -929,26 +888,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> { public Set<Cache.Entry<K, V>> entrySet(); /** - * Gets set containing cache entries that belong to provided partition or {@code null} - * if partition is not found locally. - * <p> - * NOTE: this operation is not distributed and returns only the entries cached on this node. - * - * @param part Partition. - * @return Set containing partition's entries or {@code null} if partition is - * not found locally. - */ - @Nullable public Set<Cache.Entry<K, V>> entrySet(int part); - - /** - * Gets entry set containing internal entries. - * - * @param filter Filter. - * @return Entry set. - */ - public Set<Cache.Entry<K, V>> entrySetx(CacheEntryPredicate... filter); - - /** * Starts new transaction with the specified concurrency and isolation. * * @param concurrency Concurrency. http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java index f021b65..dcc2d8b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java @@ -139,15 +139,6 @@ public class GridCachePartitionedConcurrentMap implements GridCacheConcurrentMap } /** {@inheritDoc} */ - @Override public Set<KeyCacheObject> keySet(final CacheEntryPredicate... filter) { - return new PartitionedSet<KeyCacheObject>() { - @Override protected Set<KeyCacheObject> set(GridDhtLocalPartition part) { - return part.keySet(filter); - } - }; - } - - /** {@inheritDoc} */ @Override public Iterable<GridCacheMapEntry> entries(final CacheEntryPredicate... filter) { return new Iterable<GridCacheMapEntry>() { @Override public Iterator<GridCacheMapEntry> iterator() { http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index 121c734..02badc1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -1077,101 +1077,10 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap } /** {@inheritDoc} */ - @Override public Set<Cache.Entry<K, V>> entrySet(int part) { - return new PartitionEntrySet(part); - } - - /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridDhtCacheAdapter.class, this, super.toString()); } - /** - * - */ - private class PartitionEntrySet extends AbstractSet<Cache.Entry<K, V>> { - /** */ - private int partId; - - /** - * @param partId Partition id. - */ - private PartitionEntrySet(int partId) { - this.partId = partId; - } - - /** {@inheritDoc} */ - @NotNull @Override public Iterator<Cache.Entry<K, V>> iterator() { - final GridDhtLocalPartition part = ctx.topology().localPartition(partId, - ctx.discovery().topologyVersionEx(), false); - - Iterator<GridCacheMapEntry> partIt = part == null ? null : part.entries().iterator(); - - return new PartitionEntryIterator(partIt); - } - - /** {@inheritDoc} */ - @Override public boolean remove(Object o) { - if (!(o instanceof Cache.Entry)) - return false; - - Cache.Entry<K, V> entry = (Cache.Entry<K, V>)o; - - K key = entry.getKey(); - V val = entry.getValue(); - - if (val == null) - return false; - - try { - // Cannot use remove(key, val) since we may be in DHT cache and should go through near. - return GridDhtCacheAdapter.this.remove(key, val); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - /** {@inheritDoc} */ - @Override public boolean removeAll(Collection<?> c) { - boolean rmv = false; - - for (Object o : c) - rmv |= remove(o); - - return rmv; - } - - /** {@inheritDoc} */ - @Override public boolean contains(Object o) { - if (!(o instanceof Cache.Entry)) - return false; - - Cache.Entry<K, V> entry = (Cache.Entry<K, V>)o; - - try { - return partId == ctx.affinity().partition(entry.getKey()) && - F.eq(entry.getValue(), localPeek(entry.getKey(), CachePeekModes.ONHEAP_ONLY, null)); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - /** {@inheritDoc} */ - @Override public int size() { - GridDhtLocalPartition part = ctx.topology().localPartition(partId, - ctx.discovery().topologyVersionEx(), false); - - return part != null ? part.publicSize() : 0; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(PartitionEntrySet.class, this, "super", super.toString(), true); - } - } - /** {@inheritDoc} */ @Override public List<GridCacheClearAllRunnable<K, V>> splitClearLocally(boolean srv, boolean near, boolean readers) { @@ -1323,77 +1232,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap } /** - * Complex partition iterator for both partition and swap iteration. - */ - private class PartitionEntryIterator extends GridIteratorAdapter<Cache.Entry<K, V>> { - /** */ - private static final long serialVersionUID = 0L; - - /** Next entry. */ - private Cache.Entry<K, V> entry; - - /** Last seen entry to support remove. */ - private Cache.Entry<K, V> last; - - /** Partition iterator. */ - private final Iterator<GridCacheMapEntry> partIt; - - /** - * @param partIt Partition iterator. - */ - private PartitionEntryIterator(@Nullable Iterator<GridCacheMapEntry> partIt) { - this.partIt = partIt; - - advance(); - } - - /** {@inheritDoc} */ - @Override public boolean hasNextX() { - return entry != null; - } - - /** {@inheritDoc} */ - @Override public Cache.Entry<K, V> nextX() throws IgniteCheckedException { - if (!hasNext()) - throw new NoSuchElementException(); - - last = entry; - - advance(); - - return last; - } - - /** {@inheritDoc} */ - @Override public void removeX() throws IgniteCheckedException { - if (last == null) - throw new IllegalStateException(); - - ctx.grid().cache(ctx.name()).remove(last.getKey(), last.getValue()); - } - - /** - * - */ - private void advance() { - if (partIt != null) { - while (partIt.hasNext()) { - GridCacheEntryEx next = partIt.next(); - - if (next instanceof GridCacheMapEntry && (!((GridCacheMapEntry)next).visitable(CU.empty0()))) - continue; - - entry = next.wrapLazyValue(ctx.keepBinary()); - - return; - } - } - - entry = null; - } - } - - /** * Multi update future. */ @SuppressWarnings("TypeMayBeWeakened") http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java index 0b25f58..f8240f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java @@ -339,23 +339,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda } /** {@inheritDoc} */ - @Override public Set<Cache.Entry<K, V>> entrySet(int part) { - return dht().entrySet(part); - } - - /** - * @return Keys for near cache only. - */ - public Set<K> nearKeySet() { - return super.keySet(); - } - - /** {@inheritDoc} */ - @Override public Collection<V> values() { - return new GridCacheValueCollection<>(ctx, entrySet(), ctx.vararg(F.<K, V>cacheHasPeekValue())); - } - - /** {@inheritDoc} */ @Override public boolean evict(K key) { // Use unary 'and' to make sure that both sides execute. return super.evict(key) & dht().evict(key); http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java index c10e348..ca12f70 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java @@ -59,24 +59,6 @@ public class GridCachePartitionedFullApiSelfTest extends GridCacheAbstractFullAp /** * @throws Exception If failed. */ - public void testPartitionEntrySetToString() throws Exception { - GridCacheAdapter<String, Integer> cache = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 100; i++) { - String key = String.valueOf(i); - - cache.getAndPut(key, i); - } - - Affinity aff = grid(0).affinity(cache.name()); - - for (int i = 0 ; i < aff.partitions(); i++) - String.valueOf(cache.entrySet(i)); - } - - /** - * @throws Exception If failed. - */ public void testUpdate() throws Exception { if (gridCount() > 1) { IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME); http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java index b5bfcea..7fb40a3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java @@ -780,7 +780,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>> if (plcMax > 0) { for (int i = 0; i < gridCnt; i++) { - int actual = colocated(i).map().keySet().size(); + int actual = colocated(i).map().size(); assertTrue("Cache size is greater then policy size [expected=" + endSize + ", actual=" + actual + ']', actual <= endSize + (plcMaxMemSize > 0 ? 1 : plcBatchSize)); @@ -973,15 +973,16 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>> /** * @param plc Policy. + * @return Policy proxy. */ public static EvictionPolicyProxy proxy(EvictionPolicy plc) { return new EvictionPolicyProxy(plc); } /** - * Get current size. + * @return Get current size. */ - public int getCurrentSize() { + int getCurrentSize() { try { return (Integer)plc.getClass().getDeclaredMethod("getCurrentSize").invoke(plc); } @@ -991,9 +992,9 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>> } /** - * Current memory size. + * @return Current memory size. */ - public long getCurrentMemorySize() { + long getCurrentMemorySize() { try { return (Long)plc.getClass().getMethod("getCurrentMemorySize").invoke(plc); } @@ -1003,7 +1004,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>> } /** - * Current queue. + * @return Current queue. */ public Collection<EvictableEntry> queue() { try { http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/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 9284c02..39f909e 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 @@ -37,7 +37,9 @@ import javax.cache.expiry.ExpiryPolicy; import javax.cache.expiry.ModifiedExpiryPolicy; import javax.cache.processor.EntryProcessor; import javax.cache.processor.MutableEntry; +import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.events.DiscoveryEvent; import org.apache.ignite.events.Event; import org.apache.ignite.events.EventType; @@ -101,6 +103,9 @@ import static org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTa */ public class HadoopJobTracker extends HadoopComponent { /** */ + private static final CachePeekMode[] OFFHEAP_PEEK_MODE = {CachePeekMode.OFFHEAP}; + + /** */ private final GridMutex mux = new GridMutex(); /** */ @@ -679,9 +684,20 @@ public class HadoopJobTracker extends HadoopComponent { if (ctx.jobUpdateLeader()) { boolean checkSetup = evt.eventNode().order() < ctx.localNodeOrder(); + Iterable<IgniteCache.Entry<HadoopJobId, HadoopJobMetadata>> entries; + + try { + entries = jobMetaCache().localEntries(OFFHEAP_PEEK_MODE); + } + catch (IgniteCheckedException e) { + U.error(log, "Failed to get local entries", e); + + return; + } + // Iteration over all local entries is correct since system cache is REPLICATED. - for (Object metaObj : jobMetaCache().values()) { - HadoopJobMetadata meta = (HadoopJobMetadata)metaObj; + for (IgniteCache.Entry<HadoopJobId, HadoopJobMetadata> entry : entries) { + HadoopJobMetadata meta = entry.getValue(); HadoopJobId jobId = meta.jobId(); http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java index 3d439dd..aa1f83b 100644 --- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java +++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java @@ -266,36 +266,11 @@ public class HibernateCacheProxy implements IgniteInternalCache<Object, Object> } /** {@inheritDoc} */ - @Override public Set keySetx() { - return delegate.keySetx(); - } - - /** {@inheritDoc} */ - @Override public Set primaryKeySet() { - return delegate.primaryKeySet(); - } - - /** {@inheritDoc} */ - @Override public Iterable values() { - return delegate.values(); - } - - /** {@inheritDoc} */ @Override public Set<Cache.Entry<Object, Object>> entrySet() { return delegate.entrySet(); } /** {@inheritDoc} */ - @Nullable @Override public Set<Cache.Entry<Object,Object>> entrySet(int part) { - return delegate.entrySet(part); - } - - /** {@inheritDoc} */ - @Override public Set<Cache.Entry<Object, Object>> entrySetx(CacheEntryPredicate... filter) { - return delegate.entrySetx(filter); - } - - /** {@inheritDoc} */ @Override public Transaction txStart( TransactionConcurrency concurrency, TransactionIsolation isolation
