Class AbstractForEachIntOperation<Original,K>
- java.lang.Object
-
- org.infinispan.stream.impl.termop.BaseTerminalOperation<Original>
-
- org.infinispan.stream.impl.termop.primitive.AbstractForEachIntOperation<Original,K>
-
- Type Parameters:
Original
- original stream typeK
- key type of the supplied stream
- All Implemented Interfaces:
KeyTrackingTerminalOperation<Original,K,Integer>
,SegmentAwareOperation
- Direct Known Subclasses:
ForEachIntOperation
,ForEachObjIntOperation
public abstract class AbstractForEachIntOperation<Original,K> extends BaseTerminalOperation<Original> implements KeyTrackingTerminalOperation<Original,K,Integer>
Terminal rehash aware operation that handles for each where no flat map operations are defined on aIntStream
. Note this means it is an implied map intermediate operation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.stream.impl.KeyTrackingTerminalOperation
KeyTrackingTerminalOperation.IntermediateCollector<C>
-
-
Field Summary
-
Fields inherited from class org.infinispan.stream.impl.termop.BaseTerminalOperation
intermediateOperations, supplier
-
-
Constructor Summary
Constructors Constructor Description AbstractForEachIntOperation(Iterable<IntermediateOperation> intermediateOperations, Supplier<Stream<Original>> supplier, Function<? super Original,? extends K> toKeyFunction, int batchSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
getBatchSize()
Function<? super Original,? extends K>
getToKeyFunction()
protected abstract void
handleArray(int[] array, int size)
boolean
lostSegment(boolean stopIfLost)
This method will be invoked when the operation is known to be performing on a given set of segments and this node no longer owns 1 or many of them.Collection<K>
performForEachOperation(KeyTrackingTerminalOperation.IntermediateCollector<Collection<K>> response)
Invoked when a key and rehash aware operation is desired.List<Integer>
performOperation(KeyTrackingTerminalOperation.IntermediateCollector<Collection<Integer>> response)
Invoked when a key aware operation is desired without rehash being enabled.-
Methods inherited from class org.infinispan.stream.impl.termop.BaseTerminalOperation
getIntermediateOperations, handleInjection, setSupplier
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.stream.impl.KeyTrackingTerminalOperation
handleInjection, setSupplier
-
-
-
-
Method Detail
-
lostSegment
public boolean lostSegment(boolean stopIfLost)
Description copied from interface:SegmentAwareOperation
This method will be invoked when the operation is known to be performing on a given set of segments and this node no longer owns 1 or many of them. Returns whether the lost segment affected the results or not. If stopIfLost is true then doneWithOperation will not be invoked as it would normally.- Specified by:
lostSegment
in interfaceSegmentAwareOperation
- Parameters:
stopIfLost
- argument to tell the operation that if this segment affects that it should not perform any more operations if possible as all segments have been lost.- Returns:
- whether or not this operation was affected by the loss of segments
-
performOperation
public List<Integer> performOperation(KeyTrackingTerminalOperation.IntermediateCollector<Collection<Integer>> response)
Description copied from interface:KeyTrackingTerminalOperation
Invoked when a key aware operation is desired without rehash being enabled.- Specified by:
performOperation
in interfaceKeyTrackingTerminalOperation<Original,K,Integer>
- Parameters:
response
- the collector that will be called back for any intermediate results- Returns:
- the final response from the remote node
-
handleArray
protected abstract void handleArray(int[] array, int size)
-
performForEachOperation
public Collection<K> performForEachOperation(KeyTrackingTerminalOperation.IntermediateCollector<Collection<K>> response)
Description copied from interface:KeyTrackingTerminalOperation
Invoked when a key and rehash aware operation is desired.- Specified by:
performForEachOperation
in interfaceKeyTrackingTerminalOperation<Original,K,Integer>
- Parameters:
response
- the collector that will be called back for any intermediate results- Returns:
- the final response from the remote node
-
getBatchSize
public int getBatchSize()
-
-