minor - javadoc
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e2cfc3d3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e2cfc3d3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e2cfc3d3 Branch: refs/heads/sprint-2 Commit: e2cfc3d3923be5ea3aece326a93803b4fced7ea1 Parents: 63ce97e Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Tue Mar 24 18:32:49 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Tue Mar 24 18:32:49 2015 +0300 ---------------------------------------------------------------------- .../ignite/cache/CacheDistributionMode.java | 8 +- .../cache/eviction/CacheEvictableEntry.java | 96 +++++++++ .../cache/eviction/CacheEvictionFilter.java | 4 +- .../cache/eviction/CacheEvictionPolicy.java | 6 +- .../ignite/cache/eviction/EvictableEntry.java | 96 --------- .../eviction/fifo/CacheFifoEvictionPolicy.java | 14 +- .../CacheIgfsPerBlockLruEvictionPolicy.java | 24 +-- .../eviction/lru/CacheLruEvictionPolicy.java | 16 +- .../random/CacheRandomEvictionPolicy.java | 4 +- .../cache/CacheEvictableEntryImpl.java | 197 +++++++++++++++++++ .../processors/cache/EvictableEntryImpl.java | 197 ------------------- .../processors/cache/GridCacheEntryEx.java | 2 +- .../processors/cache/GridCacheMapEntry.java | 6 +- .../cache/GridCacheAlwaysEvictionPolicy.java | 2 +- .../cache/GridCacheLifecycleAwareSelfTest.java | 2 +- .../processors/cache/GridCacheTestEntryEx.java | 3 +- ...heConcurrentEvictionConsistencySelfTest.java | 4 +- .../eviction/GridCacheEvictionAbstractTest.java | 4 +- .../GridCacheEvictionFilterSelfTest.java | 2 +- .../GridCacheEvictionLockUnlockSelfTest.java | 2 +- .../cache/eviction/GridCacheMockEntry.java | 2 +- .../GridCacheFifoEvictionPolicySelfTest.java | 2 +- .../lru/GridCacheLruEvictionPolicySelfTest.java | 2 +- 23 files changed, 345 insertions(+), 350 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/CacheDistributionMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheDistributionMode.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheDistributionMode.java index f613a8f..ef545d5 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheDistributionMode.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheDistributionMode.java @@ -17,13 +17,11 @@ package org.apache.ignite.cache; +import org.apache.ignite.configuration.*; import org.jetbrains.annotations.*; /** * This enum defines mode in which partitioned cache operates. - * <p> - * Partitioned distribution mode can be configured via {@link org.apache.ignite.configuration.CacheConfiguration#getDistributionMode()} - * configuration property. */ public enum CacheDistributionMode { /** @@ -37,14 +35,14 @@ public enum CacheDistributionMode { * recently accessed keys in a smaller near cache. Amount of recently accessed keys to cache is * controlled by near eviction policy. * - * @see org.apache.ignite.configuration.CacheConfiguration#getNearEvictionPolicy() + * @see NearCacheConfiguration#getNearEvictionPolicy() */ NEAR_ONLY, /** * Mode in which local node may store primary and/or backup keys, and also will cache recently accessed keys. * Amount of recently accessed keys to cache is controlled by near eviction policy. - * @see org.apache.ignite.configuration.CacheConfiguration#getNearEvictionPolicy() + * @see NearCacheConfiguration#getNearEvictionPolicy() */ NEAR_PARTITIONED, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictableEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictableEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictableEntry.java new file mode 100644 index 0000000..568db12 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictableEntry.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.cache.eviction; + +import org.jetbrains.annotations.*; + +import javax.cache.*; + +/** + * Evictable cache entry passed into {@link CacheEvictionPolicy}. + * + * @author @java.author + * @version @java.version + */ +public interface CacheEvictableEntry<K, V> extends Cache.Entry<K, V> { + /** + * Evicts entry associated with given key from cache. Note, that entry will be evicted + * only if it's not used (not participating in any locks or transactions). + * + * @return {@code True} if entry could be evicted, {@code false} otherwise. + */ + public boolean evict(); + + /** + * Checks whether entry is currently present in cache or not. If entry is not in + * cache (e.g. has been removed) {@code false} is returned. In this case all + * operations on this entry will cause creation of a new entry in cache. + * + * @return {@code True} if entry is in cache, {@code false} otherwise. + */ + public boolean isCached(); + + /** + * Gets metadata added by eviction policy. + * + * @return Metadata value or {@code null}. + */ + @Nullable public <T> T meta(); + + /** + * Adds a new metadata. + * + * @param val Metadata value. + * @return Metadata previously added, or + * {@code null} if there was none. + */ + @Nullable public <T> T addMeta(T val); + + /** + * Adds given metadata value only if it was absent. + * + * @param val Value to add if it's not attached already. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ + @Nullable public <T> T putMetaIfAbsent(T val); + + /** + * Replaces given metadata with new {@code newVal} value only if its current value + * is equal to {@code curVal}. Otherwise, it is no-op. + * + * @param curVal Current value to check. + * @param newVal New value. + * @return {@code true} if replacement occurred, {@code false} otherwise. + */ + public <T> boolean replaceMeta(T curVal, T newVal); + + /** + * Removes metadata by name. + * + * @return Value of removed metadata or {@code null}. + */ + @Nullable public <T> T removeMeta(); + + /** + * Removes metadata only if its current value is equal to {@code val} passed in. + * + * @param val Value to compare. + * @return {@code True} if value was removed, {@code false} otherwise. + */ + public <T> boolean removeMeta(T val); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java index 43760c9..10f63ee 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java @@ -17,16 +17,14 @@ package org.apache.ignite.cache.eviction; -import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.CacheConfiguration; import javax.cache.*; import java.io.*; -import java.util.*; /** * Eviction filter to specify which entries should not be evicted. Not applicable when - * calling explicit evict via {@link EvictableEntry#evict()}. + * calling explicit evict via {@link CacheEvictableEntry#evict()}. * If {@link #evictAllowed(Cache.Entry)} method returns {@code false} then eviction * policy will not be notified and entry will never be evicted. * <p> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java index 4880584..b5f341a 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java @@ -19,8 +19,8 @@ package org.apache.ignite.cache.eviction; /** * Pluggable cache eviction policy. Usually, implementations will internally order - * cache entries based on {@link #onEntryAccessed(boolean, EvictableEntry)} notifications and - * whenever an element needs to be evicted, {@link EvictableEntry#evict()} + * cache entries based on {@link #onEntryAccessed(boolean, CacheEvictableEntry)} notifications and + * whenever an element needs to be evicted, {@link CacheEvictableEntry#evict()} * method should be called. * <p> * Ignite comes with following eviction policies out-of-the-box: @@ -46,5 +46,5 @@ public interface CacheEvictionPolicy<K, V> { * @param rmv {@code True} if entry has been removed, {@code false} otherwise. * @param entry Accessed entry. */ - public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry); + public void onEntryAccessed(boolean rmv, CacheEvictableEntry<K, V> entry); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java deleted file mode 100644 index 7cfaf1d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cache.eviction; - -import org.jetbrains.annotations.*; - -import javax.cache.*; - -/** - * Evictable cache entry passed into {@link CacheEvictionPolicy}. - * - * @author @java.author - * @version @java.version - */ -public interface EvictableEntry<K, V> extends Cache.Entry<K, V> { - /** - * Evicts entry associated with given key from cache. Note, that entry will be evicted - * only if it's not used (not participating in any locks or transactions). - * - * @return {@code True} if entry could be evicted, {@code false} otherwise. - */ - public boolean evict(); - - /** - * Checks whether entry is currently present in cache or not. If entry is not in - * cache (e.g. has been removed) {@code false} is returned. In this case all - * operations on this entry will cause creation of a new entry in cache. - * - * @return {@code True} if entry is in cache, {@code false} otherwise. - */ - public boolean isCached(); - - /** - * Gets metadata added by eviction policy. - * - * @return Metadata value or {@code null}. - */ - @Nullable public <T> T meta(); - - /** - * Adds a new metadata. - * - * @param val Metadata value. - * @return Metadata previously added, or - * {@code null} if there was none. - */ - @Nullable public <T> T addMeta(T val); - - /** - * Adds given metadata value only if it was absent. - * - * @param val Value to add if it's not attached already. - * @return {@code null} if new value was put, or current value if put didn't happen. - */ - @Nullable public <T> T putMetaIfAbsent(T val); - - /** - * Replaces given metadata with new {@code newVal} value only if its current value - * is equal to {@code curVal}. Otherwise, it is no-op. - * - * @param curVal Current value to check. - * @param newVal New value. - * @return {@code true} if replacement occurred, {@code false} otherwise. - */ - public <T> boolean replaceMeta(T curVal, T newVal); - - /** - * Removes metadata by name. - * - * @return Value of removed metadata or {@code null}. - */ - @Nullable public <T> T removeMeta(); - - /** - * Removes metadata only if its current value is equal to {@code val} passed in. - * - * @param val Value to compare. - * @return {@code True} if value was removed, {@code false} otherwise. - */ - public <T> boolean removeMeta(T val); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java index bc51527..5fa5d82 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java @@ -41,7 +41,7 @@ public class CacheFifoEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, private volatile int max = CacheConfiguration.DFLT_CACHE_SIZE; /** FIFO queue. */ - private final ConcurrentLinkedDeque8<EvictableEntry<K, V>> queue = + private final ConcurrentLinkedDeque8<CacheEvictableEntry<K, V>> queue = new ConcurrentLinkedDeque8<>(); /** @@ -92,12 +92,12 @@ public class CacheFifoEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, * * @return Read-only view ono internal {@code 'FIFO'} queue. */ - public Collection<EvictableEntry<K, V>> queue() { + public Collection<CacheEvictableEntry<K, V>> queue() { return Collections.unmodifiableCollection(queue); } /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry<K, V> entry) { if (!rmv) { if (!entry.isCached()) return; @@ -107,7 +107,7 @@ public class CacheFifoEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, shrink(); } else { - Node<EvictableEntry<K, V>> node = entry.removeMeta(); + Node<CacheEvictableEntry<K, V>> node = entry.removeMeta(); if (node != null) queue.unlinkx(node); @@ -118,8 +118,8 @@ public class CacheFifoEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, * @param entry Entry to touch. * @return {@code True} if queue has been changed by this call. */ - private boolean touch(EvictableEntry<K, V> entry) { - Node<EvictableEntry<K, V>> node = entry.meta(); + private boolean touch(CacheEvictableEntry<K, V> entry) { + Node<CacheEvictableEntry<K, V>> node = entry.meta(); // Entry has not been enqueued yet. if (node == null) { @@ -162,7 +162,7 @@ public class CacheFifoEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, int startSize = queue.sizex(); for (int i = 0; i < startSize && queue.sizex() > max; i++) { - EvictableEntry<K, V> entry = queue.poll(); + CacheEvictableEntry<K, V> entry = queue.poll(); if (entry == null) break; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/CacheIgfsPerBlockLruEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/CacheIgfsPerBlockLruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/CacheIgfsPerBlockLruEvictionPolicy.java index b82a916..83b7d9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/CacheIgfsPerBlockLruEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/CacheIgfsPerBlockLruEvictionPolicy.java @@ -55,7 +55,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I private final AtomicBoolean excludeRecompile = new AtomicBoolean(true); /** Queue. */ - private final ConcurrentLinkedDeque8<EvictableEntry<IgfsBlockKey, byte[]>> queue = + private final ConcurrentLinkedDeque8<CacheEvictableEntry<IgfsBlockKey, byte[]>> queue = new ConcurrentLinkedDeque8<>(); /** Current size of all enqueued blocks in bytes. */ @@ -93,7 +93,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I } /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, EvictableEntry<IgfsBlockKey, byte[]> entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry<IgfsBlockKey, byte[]> entry) { if (!rmv) { if (!entry.isCached()) return; @@ -113,7 +113,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I * @param entry Entry to touch. * @return {@code True} if new node has been added to queue by this call. */ - private boolean touch(EvictableEntry<IgfsBlockKey, byte[]> entry) { + private boolean touch(CacheEvictableEntry<IgfsBlockKey, byte[]> entry) { byte[] val = peek(entry); int blockSize = val != null ? val.length : 0; @@ -123,7 +123,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I // Entry has not been enqueued yet. if (meta == null) { while (true) { - Node<EvictableEntry<IgfsBlockKey, byte[]>> node = queue.offerLastx(entry); + Node<CacheEvictableEntry<IgfsBlockKey, byte[]>> node = queue.offerLastx(entry); meta = new MetaEntry(node, blockSize); @@ -155,11 +155,11 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I else { int oldBlockSize = meta.size(); - Node<EvictableEntry<IgfsBlockKey, byte[]>> node = meta.node(); + Node<CacheEvictableEntry<IgfsBlockKey, byte[]>> node = meta.node(); if (queue.unlinkx(node)) { // Move node to tail. - Node<EvictableEntry<IgfsBlockKey, byte[]>> newNode = queue.offerLastx(entry); + Node<CacheEvictableEntry<IgfsBlockKey, byte[]>> newNode = queue.offerLastx(entry); int delta = blockSize - oldBlockSize; @@ -187,8 +187,8 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I * @param entry Entry. * @return Peeked value. */ - @Nullable private byte[] peek(EvictableEntry<IgfsBlockKey, byte[]> entry) { - return (byte[])((EvictableEntryImpl)entry).peek(); + @Nullable private byte[] peek(CacheEvictableEntry<IgfsBlockKey, byte[]> entry) { + return (byte[])((CacheEvictableEntryImpl)entry).peek(); } /** @@ -202,7 +202,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I for (int i = 0; i < cnt && (maxBlocks > 0 && queue.sizex() > maxBlocks || maxSize > 0 && curSize.longValue() > maxSize); i++) { - EvictableEntry<IgfsBlockKey, byte[]> entry = queue.poll(); + CacheEvictableEntry<IgfsBlockKey, byte[]> entry = queue.poll(); if (entry == null) break; // Queue is empty. @@ -342,7 +342,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I */ private static class MetaEntry { /** Queue node. */ - private final Node<EvictableEntry<IgfsBlockKey, byte[]>> node; + private final Node<CacheEvictableEntry<IgfsBlockKey, byte[]>> node; /** Data size. */ private final int size; @@ -353,7 +353,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I * @param node Queue node. * @param size Data size. */ - private MetaEntry(Node<EvictableEntry<IgfsBlockKey, byte[]>> node, int size) { + private MetaEntry(Node<CacheEvictableEntry<IgfsBlockKey, byte[]>> node, int size) { assert node != null; assert size >= 0; @@ -364,7 +364,7 @@ public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<I /** * @return Queue node. */ - private Node<EvictableEntry<IgfsBlockKey, byte[]>> node() { + private Node<CacheEvictableEntry<IgfsBlockKey, byte[]>> node() { return node; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/CacheLruEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/CacheLruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/CacheLruEvictionPolicy.java index e46d359..939b194 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/CacheLruEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/CacheLruEvictionPolicy.java @@ -41,7 +41,7 @@ public class CacheLruEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, private volatile int max = CacheConfiguration.DFLT_CACHE_SIZE; /** Queue. */ - private final ConcurrentLinkedDeque8<EvictableEntry<K, V>> queue = + private final ConcurrentLinkedDeque8<CacheEvictableEntry<K, V>> queue = new ConcurrentLinkedDeque8<>(); /** @@ -92,12 +92,12 @@ public class CacheLruEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, * * @return Read-only view ono internal {@code 'FIFO'} queue. */ - public Collection<EvictableEntry<K, V>> queue() { + public Collection<CacheEvictableEntry<K, V>> queue() { return Collections.unmodifiableCollection(queue); } /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry<K, V> entry) { if (!rmv) { if (!entry.isCached()) return; @@ -106,7 +106,7 @@ public class CacheLruEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, shrink(); } else { - Node<EvictableEntry<K, V>> node = entry.removeMeta(); + Node<CacheEvictableEntry<K, V>> node = entry.removeMeta(); if (node != null) queue.unlinkx(node); @@ -117,8 +117,8 @@ public class CacheLruEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, * @param entry Entry to touch. * @return {@code True} if new node has been added to queue by this call. */ - private boolean touch(EvictableEntry<K, V> entry) { - Node<EvictableEntry<K, V>> node = entry.meta(); + private boolean touch(CacheEvictableEntry<K, V> entry) { + Node<CacheEvictableEntry<K, V>> node = entry.meta(); // Entry has not been enqueued yet. if (node == null) { @@ -149,7 +149,7 @@ public class CacheLruEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, } else if (queue.unlinkx(node)) { // Move node to tail. - Node<EvictableEntry<K, V>> newNode = queue.offerLastx(entry); + Node<CacheEvictableEntry<K, V>> newNode = queue.offerLastx(entry); if (!entry.replaceMeta(node, newNode)) // Was concurrently added, need to clear it from queue. @@ -169,7 +169,7 @@ public class CacheLruEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, int startSize = queue.sizex(); for (int i = 0; i < startSize && queue.sizex() > max; i++) { - EvictableEntry<K, V> entry = queue.poll(); + CacheEvictableEntry<K, V> entry = queue.poll(); if (entry == null) break; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/CacheRandomEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/CacheRandomEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/CacheRandomEvictionPolicy.java index 0cc63bc..844734d 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/CacheRandomEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/CacheRandomEvictionPolicy.java @@ -82,7 +82,7 @@ public class CacheRandomEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry<K, V> entry) { if (!entry.isCached()) return; @@ -94,7 +94,7 @@ public class CacheRandomEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V Cache.Entry<K, V> e = cache.randomEntry(); if (e != null) - e.unwrap(EvictableEntry.class).evict(); + e.unwrap(CacheEvictableEntry.class).evict(); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java new file mode 100644 index 0000000..f5c6219 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java @@ -0,0 +1,197 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import org.apache.ignite.*; +import org.apache.ignite.cache.eviction.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.internal.util.tostring.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +import java.util.*; + +/** + * Entry wrapper that never obscures obsolete entries from user. + */ +public class CacheEvictableEntryImpl<K, V> implements CacheEvictableEntry<K, V> { + /** */ + private static final UUID META_KEY = UUID.randomUUID(); + + /** Cached entry. */ + @GridToStringInclude + protected GridCacheEntryEx cached; + + /** + * @param cached Cached entry. + */ + @SuppressWarnings({"TypeMayBeWeakened"}) + protected CacheEvictableEntryImpl(GridCacheEntryEx cached) { + this.cached = cached; + } + + /** {@inheritDoc} */ + @Override public K getKey() throws IllegalStateException { + return cached.key().value(cached.context().cacheObjectContext(), false); + } + + /** {@inheritDoc} */ + @Override public boolean isCached() { + return !cached.obsoleteOrDeleted(); + } + + /** {@inheritDoc} */ + @Override public boolean evict() { + GridCacheContext<K, V> ctx = cached.context(); + + try { + assert ctx != null; + assert ctx.evicts() != null; + + return ctx.evicts().evict(cached, null, false, null); + } + catch (IgniteCheckedException e) { + U.error(ctx.grid().log(), "Failed to evict entry from cache: " + cached, e); + + return false; + } + } + + /** + * @return Peeks value. + */ + @SuppressWarnings("unchecked") + @Nullable public V peek() { + try { + CacheObject val = cached.peek(GridCachePeekMode.GLOBAL); + + return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null; + } + catch (GridCacheEntryRemovedException e) { + return null; + } + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public V getValue() { + try { + IgniteInternalTx tx = cached.context().tm().userTx(); + + if (tx != null) { + GridTuple<CacheObject> peek = tx.peek(cached.context(), false, cached.key(), null); + + if (peek != null) + return peek.get().value(cached.context().cacheObjectContext(), false); + } + + if (cached.detached()) { + CacheObject val = cached.rawGet(); + + return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null; + } + + for (;;) { + GridCacheEntryEx e = cached.context().cache().peekEx(cached.key()); + + if (e == null) + return null; + + try { + CacheObject val = e.peek(GridCachePeekMode.GLOBAL, CU.empty0()); + + return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null; + } + catch (GridCacheEntryRemovedException ignored) { + // No-op. + } + } + } + catch (GridCacheFilterFailedException ignored) { + throw new IgniteException("Should never happen."); + } + } + + /** {@inheritDoc} */ + @Nullable @Override public <T> T addMeta(T val) { + return cached.addMeta(META_KEY, val); + } + + /** {@inheritDoc} */ + @Nullable @Override public <T> T meta() { + return cached.meta(META_KEY); + } + + /** {@inheritDoc} */ + @Nullable @Override public <T> T removeMeta() { + return cached.removeMeta(META_KEY); + } + + /** {@inheritDoc} */ + @Override public <T> boolean removeMeta(T val) { + return cached.removeMeta(META_KEY, val); + } + + /** {@inheritDoc} */ + @Nullable @Override public <T> T putMetaIfAbsent(T val) { + return cached.putMetaIfAbsent(META_KEY, val); + } + + /** {@inheritDoc} */ + @Override public <T> boolean replaceMeta(T curVal, T newVal) { + return cached.replaceMeta(META_KEY,curVal, newVal); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public <T> T unwrap(Class<T> clazz) { + if (clazz.isAssignableFrom(IgniteCache.class)) + return (T)cached.context().grid().cache(cached.context().name()); + + if(clazz.isAssignableFrom(getClass())) + return clazz.cast(this); + + throw new IllegalArgumentException(); + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return cached.key().hashCode(); + } + + /** {@inheritDoc} */ + @SuppressWarnings({"unchecked"}) + @Override public boolean equals(Object obj) { + if (obj == this) + return true; + + if (obj instanceof CacheEvictableEntryImpl) { + CacheEvictableEntryImpl<K, V> other = (CacheEvictableEntryImpl<K, V>)obj; + + return cached.key().equals(other.getKey()); + } + + return false; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheEvictableEntryImpl.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/EvictableEntryImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/EvictableEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/EvictableEntryImpl.java deleted file mode 100644 index 4dbc1ae..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/EvictableEntryImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.eviction.*; -import org.apache.ignite.internal.processors.cache.transactions.*; -import org.apache.ignite.internal.util.lang.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Entry wrapper that never obscures obsolete entries from user. - */ -public class EvictableEntryImpl<K, V> implements EvictableEntry<K, V> { - /** */ - private static final UUID META_KEY = UUID.randomUUID(); - - /** Cached entry. */ - @GridToStringInclude - protected GridCacheEntryEx cached; - - /** - * @param cached Cached entry. - */ - @SuppressWarnings({"TypeMayBeWeakened"}) - protected EvictableEntryImpl(GridCacheEntryEx cached) { - this.cached = cached; - } - - /** {@inheritDoc} */ - @Override public K getKey() throws IllegalStateException { - return cached.key().value(cached.context().cacheObjectContext(), false); - } - - /** {@inheritDoc} */ - @Override public boolean isCached() { - return !cached.obsoleteOrDeleted(); - } - - /** {@inheritDoc} */ - @Override public boolean evict() { - GridCacheContext<K, V> ctx = cached.context(); - - try { - assert ctx != null; - assert ctx.evicts() != null; - - return ctx.evicts().evict(cached, null, false, null); - } - catch (IgniteCheckedException e) { - U.error(ctx.grid().log(), "Failed to evict entry from cache: " + cached, e); - - return false; - } - } - - /** - * @return Peeks value. - */ - @SuppressWarnings("unchecked") - @Nullable public V peek() { - try { - CacheObject val = cached.peek(GridCachePeekMode.GLOBAL); - - return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null; - } - catch (GridCacheEntryRemovedException e) { - return null; - } - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override public V getValue() { - try { - IgniteInternalTx tx = cached.context().tm().userTx(); - - if (tx != null) { - GridTuple<CacheObject> peek = tx.peek(cached.context(), false, cached.key(), null); - - if (peek != null) - return peek.get().value(cached.context().cacheObjectContext(), false); - } - - if (cached.detached()) { - CacheObject val = cached.rawGet(); - - return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null; - } - - for (;;) { - GridCacheEntryEx e = cached.context().cache().peekEx(cached.key()); - - if (e == null) - return null; - - try { - CacheObject val = e.peek(GridCachePeekMode.GLOBAL, CU.empty0()); - - return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null; - } - catch (GridCacheEntryRemovedException ignored) { - // No-op. - } - } - } - catch (GridCacheFilterFailedException ignored) { - throw new IgniteException("Should never happen."); - } - } - - /** {@inheritDoc} */ - @Nullable @Override public <T> T addMeta(T val) { - return cached.addMeta(META_KEY, val); - } - - /** {@inheritDoc} */ - @Nullable @Override public <T> T meta() { - return cached.meta(META_KEY); - } - - /** {@inheritDoc} */ - @Nullable @Override public <T> T removeMeta() { - return cached.removeMeta(META_KEY); - } - - /** {@inheritDoc} */ - @Override public <T> boolean removeMeta(T val) { - return cached.removeMeta(META_KEY, val); - } - - /** {@inheritDoc} */ - @Nullable @Override public <T> T putMetaIfAbsent(T val) { - return cached.putMetaIfAbsent(META_KEY, val); - } - - /** {@inheritDoc} */ - @Override public <T> boolean replaceMeta(T curVal, T newVal) { - return cached.replaceMeta(META_KEY,curVal, newVal); - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override public <T> T unwrap(Class<T> clazz) { - if (clazz.isAssignableFrom(IgniteCache.class)) - return (T)cached.context().grid().cache(cached.context().name()); - - if(clazz.isAssignableFrom(getClass())) - return clazz.cast(this); - - throw new IllegalArgumentException(); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return cached.key().hashCode(); - } - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Override public boolean equals(Object obj) { - if (obj == this) - return true; - - if (obj instanceof EvictableEntryImpl) { - EvictableEntryImpl<K, V> other = (EvictableEntryImpl<K, V>)obj; - - return cached.key().equals(other.getKey()); - } - - return false; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(EvictableEntryImpl.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java index f4edb8c..4ef91de 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java @@ -156,7 +156,7 @@ public interface GridCacheEntryEx { /** * @return Entry which is safe to pass into eviction policy. */ - public <K, V> EvictableEntry<K, V> wrapEviction(); + public <K, V> CacheEvictableEntry<K, V> wrapEviction(); /** * @return Entry which holds key and version (no value, since entry http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index cad260a..20158e1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -3797,8 +3797,8 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx { } /** {@inheritDoc} */ - @Override public <K, V> EvictableEntry<K, V> wrapEviction() { - return new EvictableEntryImpl<>(this); + @Override public <K, V> CacheEvictableEntry<K, V> wrapEviction() { + return new CacheEvictableEntryImpl<>(this); } /** {@inheritDoc} */ @@ -4349,7 +4349,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx { if (cls.isAssignableFrom(getClass())) return (T)this; - if (cls.isAssignableFrom(EvictableEntry.class)) + if (cls.isAssignableFrom(CacheEvictableEntry.class)) return (T)wrapEviction(); if (cls.isAssignableFrom(CacheVersionedEntryImpl.class)) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java index 83f1502..34db6d0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java @@ -28,7 +28,7 @@ import java.io.*; */ public class GridCacheAlwaysEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>, Externalizable { /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry<K, V> entry) { if (!rmv && entry.isCached()) entry.evict(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java index 9b1e445..6379ec0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java @@ -169,7 +169,7 @@ public class GridCacheLifecycleAwareSelfTest extends GridAbstractLifecycleAwareS } /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, EvictableEntry entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry entry) { // No-op. } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java index 2b23f2e..de6e0ed 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.processors.dr.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; import javax.cache.*; @@ -119,7 +118,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr } /** {@inheritDoc} */ - @Nullable @Override public EvictableEntry wrapEviction() { + @Nullable @Override public CacheEvictableEntry wrapEviction() { return null; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java index 0972d99..a774ed6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java @@ -207,7 +207,7 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb fut.get(); - Collection<EvictableEntry<Integer, Integer>> queue = internalQueue(plc); + Collection<CacheEvictableEntry<Integer, Integer>> queue = internalQueue(plc); info("Test results [threadCnt=" + threadCnt + ", iterCnt=" + ITERATION_CNT + ", cacheSize=" + cache.size() + ", internalQueueSize" + queue.size() + ", duration=" + (System.currentTimeMillis() - start) + ']'); @@ -247,7 +247,7 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb * @param plc Policy to get queue from. * @return Internal entries collection. */ - private Collection<EvictableEntry<Integer, Integer>> internalQueue(CacheEvictionPolicy<?, ?> plc) { + private Collection<CacheEvictableEntry<Integer, Integer>> internalQueue(CacheEvictionPolicy<?, ?> plc) { if (plc instanceof CacheFifoEvictionPolicy) { CacheFifoEvictionPolicy<Integer, Integer> plc0 = (CacheFifoEvictionPolicy<Integer, Integer>)plc; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java index 7ea3be9..aabaeeb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java @@ -161,7 +161,7 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic * @param c1 Policy collection. * @param c2 Expected list. */ - protected void check(Collection<EvictableEntry<String, String>> c1, MockEntry... c2) { + protected void check(Collection<CacheEvictableEntry<String, String>> c1, MockEntry... c2) { check(c1, F.asList(c2)); } @@ -197,7 +197,7 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic * @param c1 Policy collection. * @param c2 Expected list. */ - protected void check(Collection<EvictableEntry<String, String>> c1, List<MockEntry> c2) { + protected void check(Collection<CacheEvictableEntry<String, String>> c1, List<MockEntry> c2) { assert c1.size() == c2.size() : "Mismatch [actual=" + string(c1) + ", expected=" + string(c2) + ']'; assert c1.containsAll(c2) : "Mismatch [actual=" + string(c1) + ", expected=" + string(c2) + ']'; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java index 6d267ea..35929d1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java @@ -54,7 +54,7 @@ public class GridCacheEvictionFilterSelfTest extends GridCommonAbstractTest { /** Policy. */ private CacheEvictionPolicy<Object, Object> plc = new CacheEvictionPolicy<Object, Object>() { - @Override public void onEntryAccessed(boolean rmv, EvictableEntry entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry entry) { assert !(entry.getValue() instanceof Integer); } }; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java index 87011d2..db90baf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java @@ -171,7 +171,7 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest /** Eviction policy. */ private static class EvictionPolicy implements CacheEvictionPolicy<Object, Object>, Serializable { /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, EvictableEntry<Object, Object> entry) { + @Override public void onEntryAccessed(boolean rmv, CacheEvictableEntry<Object, Object> entry) { touchCnt.incrementAndGet(); entry.evict(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java index 4dbcc09..856a2e6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java @@ -31,7 +31,7 @@ import java.util.*; * Mock cache entry. */ public class GridCacheMockEntry<K, V> extends GridMetadataAwareAdapter implements Cache.Entry<K, V>, - EvictableEntry<K, V> { + CacheEvictableEntry<K, V> { /** */ private static final UUID META_KEY = UUID.randomUUID(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoEvictionPolicySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoEvictionPolicySelfTest.java index 6e8747d..db48635 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoEvictionPolicySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoEvictionPolicySelfTest.java @@ -360,7 +360,7 @@ public class GridCacheFifoEvictionPolicySelfTest extends /** {@inheritDoc} */ @Override protected void checkNearPolicies(int endNearPlcSize) { for (int i = 0; i < gridCnt; i++) - for (EvictableEntry<String, String> e : nearPolicy(i).queue()) + for (CacheEvictableEntry<String, String> e : nearPolicy(i).queue()) assert !e.isCached() : "Invalid near policy size: " + nearPolicy(i).queue(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cfc3d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/GridCacheLruEvictionPolicySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/GridCacheLruEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/GridCacheLruEvictionPolicySelfTest.java index 7f30879..fe8520f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/GridCacheLruEvictionPolicySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/GridCacheLruEvictionPolicySelfTest.java @@ -405,7 +405,7 @@ public class GridCacheLruEvictionPolicySelfTest extends /** {@inheritDoc} */ @Override protected void checkNearPolicies(int endNearPlcSize) { for (int i = 0; i < gridCnt; i++) - for (EvictableEntry<String, String> e : nearPolicy(i).queue()) + for (CacheEvictableEntry<String, String> e : nearPolicy(i).queue()) assert !e.isCached() : "Invalid near policy size: " + nearPolicy(i).queue(); }