Class 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 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_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 query
        filter - the query expressed as a Filter
        setPids - 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 query
        filter - the query expressed as a Filter
        setPids - the partitions to execute the query against
        fByMember - indicates whether it is by-member iterations
        fRandom - 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 class com.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 class com.oracle.coherence.common.collections.AbstractStableIterator<T>
        Parameters:
        oPrev - the previously iterated object that should be removed