public class SharedDataIteratorSource<T> extends Object
SharedDataIterator
over a single DataIterator
, the iterator source
is in charge of mediating between the shared iterators, always only one shared iterator is
accessing the actual iteratorConstructor and Description |
---|
SharedDataIteratorSource(Object identifier,
ISourceDataIteratorProvider<T> sourceDataIteratorProvider,
long timeToLive)
Construct a new source
|
Modifier and Type | Method and Description |
---|---|
void |
addStateChangedListener(ISharedDataIteratorSourceStateChangedListener<T> listener)
Subscribe to state changed events
|
void |
closeSharedIterator()
Signal the source this shared data iterator is closed
|
DataIterator<T> |
getIterator()
Gets a new shared data iterator over the source data iterator
|
T |
getNext(int index)
Called by the shared iterators to get their next object according to the specified index
|
public SharedDataIteratorSource(Object identifier, ISourceDataIteratorProvider<T> sourceDataIteratorProvider, long timeToLive)
sourceDataIterator
- data iterator to wraptimeToLive
- time in miliseconds that once elapsed this iterator source is
considered expired and will no longer receive requests for new
iteratorspublic DataIterator<T> getIterator() throws SharedDataIteratorSourceClosedException, SharedDataIteratorSourceExpiredException, DataSourceException
public void closeSharedIterator()
public T getNext(int index)
index
- specified indexpublic void addStateChangedListener(ISharedDataIteratorSourceStateChangedListener<T> listener)
Copyright © GigaSpaces.