Interface Repeat<C extends FlowContext>

Type Parameters:
C - the type of the context shared between tasks
All Superinterfaces:
Promisable<C>, Subscription<C>

public interface Repeat<C extends FlowContext> extends Promisable<C>, Subscription<C>
An interface to control the repeated execution of an asynchronous task.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
    By default, the execution of task fails fast.
    static final long
    By default, the interval between the iterations is 1 second.
    static final int
    By default, the number of iterations are infinite.
    static final long
    By default, the timeout for the loop is 10 seconds.
  • Method Summary

    Modifier and Type
    Method
    Description
    failFast(boolean failFast)
    Whether the execution of the task should fail fast or fail last.
    interval(long interval)
    The interval in milliseconds between the iterations.
    iterations(int iterations)
    The maximal number of iterations of the loop.
    timeout(long timeout)
    The timeout in milliseconds for the while loop.
    while_(Predicate<C> predicate)
    The task is executed as long as the given predicate evaluates to true.

    Methods inherited from interface org.jboss.elemento.flow.Promisable

    catch_, finally_, promise, then, then

    Methods inherited from interface org.jboss.elemento.flow.Subscription

    subscribe
  • Field Details

    • DEFAULT_FAIL_FAST

      static final boolean DEFAULT_FAIL_FAST
      By default, the execution of task fails fast.
      See Also:
    • DEFAULT_INTERVAL

      static final long DEFAULT_INTERVAL
      By default, the interval between the iterations is 1 second.
      See Also:
    • DEFAULT_TIMEOUT

      static final long DEFAULT_TIMEOUT
      By default, the timeout for the loop is 10 seconds.
      See Also:
    • DEFAULT_ITERATIONS

      static final int DEFAULT_ITERATIONS
      By default, the number of iterations are infinite.
      See Also:
  • Method Details

    • while_

      Repeat<C> while_(Predicate<C> predicate)
      The task is executed as long as the given predicate evaluates to true. Defaults to a precondition which always returns true.
    • failFast

      Repeat<C> failFast(boolean failFast)
      Whether the execution of the task should fail fast or fail last. Defaults to true<C extends FlowContext>.
    • interval

      Repeat<C> interval(long interval)
      The interval in milliseconds between the iterations. Defaults to 1000L<C extends FlowContext> milliseconds.
    • timeout

      Repeat<C> timeout(long timeout)
      The timeout in milliseconds for the while loop. Defaults to 10000L<C extends FlowContext> milliseconds.
    • iterations

      Repeat<C> iterations(int iterations)
      The maximal number of iterations of the loop. Defaults to an infinite loop (-1<C extends FlowContext>).