Class SingleRunOperation<Original,E,R,S extends BaseStream<R,S>,S2 extends S>
- java.lang.Object
-
- org.infinispan.stream.impl.termop.BaseTerminalOperation<Original>
-
- org.infinispan.stream.impl.termop.SingleRunOperation<Original,E,R,S,S2>
-
- Type Parameters:
Original
- original stream typeE
- type of the output of the functionR
- type of the stream entriesS
- type of the stream itself
- All Implemented Interfaces:
SegmentAwareOperation
,TerminalOperation<Original,E>
public class SingleRunOperation<Original,E,R,S extends BaseStream<R,S>,S2 extends S> extends BaseTerminalOperation<Original> implements TerminalOperation<Original,E>
Runs the provided function once only and returns the result. This is useful for operations that can be performed and its result is still valid even when a segment is lost.
-
-
Field Summary
-
Fields inherited from class org.infinispan.stream.impl.termop.BaseTerminalOperation
intermediateOperations, supplier
-
-
Constructor Summary
Constructors Constructor Description SingleRunOperation(Iterable<IntermediateOperation> intermediateOperations, Supplier<Stream<Original>> supplier, Function<? super S2,? extends E> function)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Function<? super S2,? extends E>
getFunction()
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.E
performOperation()
Actually runs the terminal operation returning the result from the operation-
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.TerminalOperation
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 E performOperation()
Description copied from interface:TerminalOperation
Actually runs the terminal operation returning the result from the operation- Specified by:
performOperation
in interfaceTerminalOperation<Original,E>
- Returns:
- the value retrieved for the operation
-
-