Class SegmentRetryingOperation<Original,​E,​T,​S extends BaseStream<T,​S>,​S2 extends S>

  • Type Parameters:
    Original - original stream type
    E - output type of the function
    T - type of the stream entries
    S - type of the stream itself
    All Implemented Interfaces:
    SegmentAwareOperation, TerminalOperation<Original,​E>

    public class SegmentRetryingOperation<Original,​E,​T,​S extends BaseStream<T,​S>,​S2 extends S>
    extends BaseTerminalOperation<Original>
    implements TerminalOperation<Original,​E>
    A terminal based operation that runs the provided function to evaluate the operation. If a segment is lost during the evaluation of the function the function results will be ignored and subsequently retried with the new stable segments. This is repeated until either a full stable run is completed of the function or if the lost segment states that there are no more segments left.
    • 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 interface SegmentAwareOperation
        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 interface TerminalOperation<Original,​E>
        Returns:
        the value retrieved for the operation
      • getFunction

        public Function<? super S2,​? extends E> getFunction()