Package org.infinispan.stream.impl
Class IteratorHandler
- java.lang.Object
-
- org.infinispan.stream.impl.IteratorHandler
-
public class IteratorHandler extends Object
Handler for storing iterators between invocations so that remote node can request data in chunks.- Since:
- 9.2
- Author:
- wburns
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
IteratorHandler.OnCloseIterator<E>
ACloseableIterator
that also allows callers to attachRunnable
instances to it, so that when this iterator is closed, those Runnables are also invoked.
-
Constructor Summary
Constructors Constructor Description IteratorHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeIterator(Address origin, Object requestId)
Invoked to have handler forget about given iterator they requested.<E> org.infinispan.commons.util.CloseableIterator<E>
getIterator(Object requestId)
int
openIterators()
Returns how many iterators are currently openvoid
start()
<Original,E>
IteratorHandler.OnCloseIterator<E>start(Address origin, Supplier<Stream<Original>> streamSupplier, Iterable<org.infinispan.stream.impl.intops.IntermediateOperation> intOps, Object requestId)
Starts an iteration process from the given stream that converts the stream to a subsequent stream using the given intermediate operations and then creates a managed iterator for the caller to subsequently retrieve.void
stop()
void
viewChange(ViewChangedEvent event)
-
-
-
Method Detail
-
viewChange
public void viewChange(ViewChangedEvent event)
-
start
public void start()
-
stop
public void stop()
-
start
public <Original,E> IteratorHandler.OnCloseIterator<E> start(Address origin, Supplier<Stream<Original>> streamSupplier, Iterable<org.infinispan.stream.impl.intops.IntermediateOperation> intOps, Object requestId)
Starts an iteration process from the given stream that converts the stream to a subsequent stream using the given intermediate operations and then creates a managed iterator for the caller to subsequently retrieve.- Type Parameters:
Original
- original stream typeE
- resulting type- Parameters:
streamSupplier
- the supplied streamintOps
- the intermediate operations to perform on the stream- Returns:
- the id of the managed iterator
-
getIterator
public <E> org.infinispan.commons.util.CloseableIterator<E> getIterator(Object requestId)
-
openIterators
public int openIterators()
Returns how many iterators are currently open- Returns:
- how many iterators are currently open
-
closeIterator
public void closeIterator(Address origin, Object requestId)
Invoked to have handler forget about given iterator they requested. This should be invoked when anIterator
has been found to have completedIterator.hasNext()
is false or if the caller wishes to stop a given iteration early. If an iterator is fully iterated upon (ie.Iterator.hasNext()
returns false, that invocation will also close resources related to the iterator.- Parameters:
requestId
- the id of the iterator
-
-