GigaSpaces XAP 7.0 API

org.openspaces.persistency.support
Class ConcurrentMultiDataIterator

java.lang.Object
  extended by org.openspaces.persistency.support.ConcurrentMultiDataIterator
All Implemented Interfaces:
DataIterator, Iterator, MultiDataIterator

public class ConcurrentMultiDataIterator
extends Object
implements MultiDataIterator

A simple implementation wrapping several iterators and exposing them as concurrent iterator using a fixed size thread pool. If a given iterator is a MultiDataIterator it will flatten it by getting its respective list of iterators.

Note, this implementation assumes that hasNext() is called before next() is called. And that next() is called only when hasNext() returns true.

Author:
kimchy

Constructor Summary
ConcurrentMultiDataIterator(DataIterator[] iterators, int threadPoolSize)
           
 
Method Summary
 void close()
          Clean up after any resources associated with this iterator The iterator can be closed even if the iterator wasn't iterated over all of its elements.
 boolean hasNext()
           
 DataIterator[] iterators()
          Returns the underlying iterators.
 Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentMultiDataIterator

public ConcurrentMultiDataIterator(DataIterator[] iterators,
                                   int threadPoolSize)
Method Detail

iterators

public DataIterator[] iterators()
Description copied from interface: MultiDataIterator
Returns the underlying iterators. Note, calling this method should only be performed if no iteration has happened.

Specified by:
iterators in interface MultiDataIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

next

public Object next()
Specified by:
next in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

close

public void close()
Description copied from interface: DataIterator
Clean up after any resources associated with this iterator The iterator can be closed even if the iterator wasn't iterated over all of its elements.

Specified by:
close in interface DataIterator

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.