Package com.tangosol.net.partition
Class AbstractPartitionedIterator<T>
- java.lang.Object
-
- com.oracle.coherence.common.collections.AbstractStableIterator<T>
-
- com.tangosol.net.partition.AbstractPartitionedIterator<T>
-
- All Implemented Interfaces:
Enumeration<T>
,Iterator<T>
- Direct Known Subclasses:
PartitionedIterator
public abstract class AbstractPartitionedIterator<T> extends com.oracle.coherence.common.collections.AbstractStableIterator<T>
Abstract base class for partitioned iterators.- Author:
- as 2015.01.27
-
-
Field Summary
Fields Modifier and Type Field Description protected NamedCache
m_cache
The cache to query from.protected boolean
m_fByMember
Differentiates between by-member and by-partition iteration.protected PartitionedFilter
m_filter
The filter to query with.protected boolean
m_fRandom
An option to randomize the order of iteration to avoid harmonics in a clustered environment.protected PartitionSet
m_setPids
The remaining set of partitions to iterate.static int
OPT_BY_MEMBER
An option to iterate one member at a time.static int
OPT_BY_PARTITION
An option to iterate one partition at a time.static int
OPT_RANDOMIZED
An option to iterate the members or partitions in a randomized order.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPartitionedIterator(Filter filter, NamedCache cache, PartitionSet setPids)
Create AbstractPartitionedIterator instance.protected
AbstractPartitionedIterator(Filter filter, NamedCache cache, PartitionSet setPids, boolean fByMember, boolean fRandom)
Create AbstractPartitionedIterator instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
advance()
Advance to the next object.protected abstract Iterable<T>
nextIterable(PartitionedFilter filter)
Obtain the next Iterable for a given filter.protected void
remove(Object oPrev)
Remove the specified item.-
Methods inherited from class com.oracle.coherence.common.collections.AbstractStableIterator
getPrevious, hasMoreElements, hasNext, next, nextElement, remove, setNext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Enumeration
asIterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
OPT_BY_PARTITION
public static final int OPT_BY_PARTITION
An option to iterate one partition at a time. This is the default.- See Also:
- Constant Field Values
-
OPT_BY_MEMBER
public static final int OPT_BY_MEMBER
An option to iterate one member at a time.- See Also:
- Constant Field Values
-
OPT_RANDOMIZED
public static final int OPT_RANDOMIZED
An option to iterate the members or partitions in a randomized order. Note that this does not refer to the order that the individual keys or entries themselves will be iterated.- See Also:
- Constant Field Values
-
m_cache
protected NamedCache m_cache
The cache to query from.
-
m_filter
protected PartitionedFilter m_filter
The filter to query with.
-
m_setPids
protected PartitionSet m_setPids
The remaining set of partitions to iterate.
-
m_fByMember
protected boolean m_fByMember
Differentiates between by-member and by-partition iteration. If true, all partitions of a given member are iterated in a single chunk; if false, each partition is iterated individually.
-
m_fRandom
protected boolean m_fRandom
An option to randomize the order of iteration to avoid harmonics in a clustered environment.
-
-
Constructor Detail
-
AbstractPartitionedIterator
protected AbstractPartitionedIterator(Filter filter, NamedCache cache, PartitionSet setPids)
Create AbstractPartitionedIterator instance.- Parameters:
cache
- the cache to queryfilter
- the query expressed as a FiltersetPids
- the partitions to execute the query against
-
AbstractPartitionedIterator
protected AbstractPartitionedIterator(Filter filter, NamedCache cache, PartitionSet setPids, boolean fByMember, boolean fRandom)
Create AbstractPartitionedIterator instance.- Parameters:
cache
- the cache to queryfilter
- the query expressed as a FiltersetPids
- the partitions to execute the query againstfByMember
- indicates whether it is by-member iterationsfRandom
- indicates whether the order of iteration is randomized
-
-
Method Detail
-
nextIterable
protected abstract Iterable<T> nextIterable(PartitionedFilter filter)
Obtain the next Iterable for a given filter. This method is called when the Iterable returned by the previous call is exhausted.- Parameters:
filter
- filter to use- Returns:
- a next Iterable or null if there is no more data to iterate
-
advance
protected void advance()
Description copied from class:com.oracle.coherence.common.collections.AbstractStableIterator
Advance to the next object.This method must be implemented by the concrete sub-class by calling
AbstractStableIterator.setNext(T)
if there is a next object.- Specified by:
advance
in classcom.oracle.coherence.common.collections.AbstractStableIterator<T>
-
remove
protected void remove(Object oPrev)
Description copied from class:com.oracle.coherence.common.collections.AbstractStableIterator
Remove the specified item.This is an optional operation. If the Iterator supports element removal, then it should implement this method, which is delegated to by the
AbstractStableIterator.remove()
method.- Overrides:
remove
in classcom.oracle.coherence.common.collections.AbstractStableIterator<T>
- Parameters:
oPrev
- the previously iterated object that should be removed
-
-