K
- the type of key.V
- the type of value.public abstract class AbstractClusterWideIterator<K,V> extends Object implements Iterator<javax.cache.Cache.Entry<K,V>>
AbstractClusterWideIterator
provides the core iterator functionality shared by its descendants.
Hazelcast cluster is made of partitions which holds a slice of all clusters data. Partition count never increase or decrease in a cluster. In order to implement an iterator over a partitioned data, we use the following parameters.
Iteration steps:
next()
when method is called.next()
, more keys are fetched from the cluster.SampleableConcurrentHashMap
.
hasNext()
may return true for a key already removed.hasNext()
only return false when all known keys are fetched and iterated.next()
may return null although cache never has null value. This may happen when, for example,
someone removes the entry after the current thread has checked with hasNext()
.next()
called.Modifier and Type | Field and Description |
---|---|
protected ICache<K,V> |
cache |
protected int |
currentIndex |
protected int |
fetchSize |
protected int |
index |
protected int |
lastTableIndex |
protected int |
partitionCount |
protected int |
partitionIndex |
protected CacheKeyIteratorResult |
result |
Constructor and Description |
---|
AbstractClusterWideIterator(ICache<K,V> cache,
int partitionCount) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
advance() |
protected void |
ensureOpen() |
protected abstract CacheKeyIteratorResult |
fetch() |
protected int |
getPartitionCount() |
boolean |
hasNext() |
javax.cache.Cache.Entry<K,V> |
next() |
void |
remove() |
protected abstract Data |
toData(Object obj) |
protected abstract <T> T |
toObject(Object data) |
protected CacheKeyIteratorResult result
protected final int partitionCount
protected int partitionIndex
protected int lastTableIndex
protected final int fetchSize
protected int index
protected int currentIndex
public boolean hasNext()
public void remove()
protected boolean advance()
protected void ensureOpen()
protected int getPartitionCount()
protected abstract CacheKeyIteratorResult fetch()
protected abstract <T> T toObject(Object data)
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.