Package org.cache2k.core
Class ConcurrentEntryIterator<K,V>
- java.lang.Object
-
- org.cache2k.core.ConcurrentEntryIterator<K,V>
-
public class ConcurrentEntryIterator<K,V> extends Object implements Iterator<Entry<K,V>>
Iterator over all cache entries.Hash expansion: During the iteration a hash expansion may happen, which means every entry is rehashed. In this case it is most likely that entries are missed. If an expansion occurred, the iteration will restart from the beginning. To ensure that every entry is only iterated once, the iterator has an internal bookkeeping, what was previously iterated.
Clear: A clear operation stops current iterations.
Close: A close operation will stop the iteration and yield a
CacheClosedException- Author:
- Jens Wilke
-
-
Constructor Summary
Constructors Constructor Description ConcurrentEntryIterator(HeapCache<K,V> cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasBeenIterated(K key, int hashCode)Used by the storage code to filter out already iterated keysbooleanhasNext()voidmarkIterated(K key, int hashCode)Mark the key as returned by the iteration to suppress doubled iterations when we need to scan throw twice ore more, e.g.Entry<K,V>next()voidremove()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Method Detail
-
hasBeenIterated
public boolean hasBeenIterated(K key, int hashCode)
Used by the storage code to filter out already iterated keys
-
markIterated
public void markIterated(K key, int hashCode)
Mark the key as returned by the iteration to suppress doubled iterations when we need to scan throw twice ore more, e.g. in case of a hash table expansion.- Parameters:
key- key objecthashCode- corresponding modified hash, unused but we keep it if we want to switch to a more efficient hash table
-
-