Class RepeatTask<C extends FlowContext>

    • Constructor Detail

      • RepeatTask

        public RepeatTask​(Task<C> task,
                          Predicate<C> predicate,
                          boolean failFast,
                          long interval,
                          long timeout)
        Creates a new task that executes the given tasks as long as the given predicate evaluates to true.

        The task re-uses the context from the outer call to Flow.parallel(FlowContext, List), Flow.sequential(FlowContext, List) or Flow.repeat(FlowContext, Task).

        Parameters:
        task - the task to execute while the predicate evaluates to true
        predicate - the predicate used to decide whether to continue or break the loop
        failFast - whether the execution of the list should fail fast or fail last
        interval - the interval between the iterations
        timeout - the timeout for the while loop
      • RepeatTask

        public RepeatTask​(Task<C> task,
                          Predicate<C> predicate,
                          boolean failFast,
                          long interval,
                          long timeout,
                          int iterations)
        Creates a new task that executes the given tasks as long as the given predicate evaluates to true.

        The task re-uses the context from the outer call to Flow.parallel(FlowContext, List), Flow.sequential(FlowContext, List) or Flow.repeat(FlowContext, Task).

        Parameters:
        task - the task to execute while the predicate evaluates to true
        predicate - the predicate used to decide whether to continue or break the loop
        failFast - whether the execution of the list should fail fast or fail last
        interval - the interval between the iterations
        timeout - the timeout for the while loop
        iterations - the maximal iterations the loop
      • RepeatTask

        public RepeatTask​(C context,
                          Task<C> task,
                          Predicate<C> predicate,
                          boolean failFast,
                          long interval,
                          long timeout)
        Creates a new task that executes the given tasks as long as the given predicate evaluates to true.

        The task uses the given context for the execution of the task.

        Parameters:
        context - the context shared between the iterations
        task - the task to execute while the predicate evaluates to true
        predicate - the predicate used to decide whether to continue or break the loop
        failFast - whether the execution of the list should fail fast or fail last
        interval - the interval between the iterations
        timeout - the timeout for the while loop
        iterations - the maximal iterations the loop
      • RepeatTask

        public RepeatTask​(C context,
                          Task<C> task,
                          Predicate<C> predicate,
                          boolean failFast,
                          long interval,
                          long timeout,
                          int iterations)
        Creates a new task that executes the given tasks as long as the given predicate evaluates to true.

        The task uses the given context for the execution of the task.

        Parameters:
        context - the context shared between the iterations
        task - the task to execute while the predicate evaluates to true
        predicate - the predicate used to decide whether to continue or break the loop
        failFast - whether the execution of the list should fail fast or fail last
        interval - the interval between the iterations
        timeout - the timeout for the while loop
        iterations - the maximal iterations the loop
    • Method Detail

      • apply

        public elemental2.promise.Promise<C> apply​(C context)
        Description copied from interface: Task
        Executes the task.
        Specified by:
        apply in interface Task<C extends FlowContext>
        Parameters:
        context - the context shared between tasks
        Returns:
        a promise containing the shared context