Package org.jboss.elemento.flow
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 booleanDEFAULT_FAIL_FASTBy default, the execution of task fails fast.static longDEFAULT_INTERVALBy default, the interval between the iterations is 1 second.static intDEFAULT_ITERATIONSBy default, the number of iterations are infinite.static longDEFAULT_TIMEOUTBy default, the timeout for the loop is 10 seconds.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Repeat<C>failFast(boolean failFast)Whether the execution of the task should fail fast or fail last.Repeat<C>interval(long interval)The interval in milliseconds between the iterations.Repeat<C>iterations(int iterations)The maximal number of iterations of the loop.Repeat<C>timeout(long timeout)The timeout in milliseconds for the while loop.Repeat<C>while_(Predicate<C> predicate)The task is executed as long as the given predicate evaluates totrue.-
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 Detail
-
DEFAULT_FAIL_FAST
static final boolean DEFAULT_FAIL_FAST
By default, the execution of task fails fast.- See Also:
- Constant Field Values
-
DEFAULT_INTERVAL
static final long DEFAULT_INTERVAL
By default, the interval between the iterations is 1 second.- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
static final long DEFAULT_TIMEOUT
By default, the timeout for the loop is 10 seconds.- See Also:
- Constant Field Values
-
DEFAULT_ITERATIONS
static final int DEFAULT_ITERATIONS
By default, the number of iterations are infinite.- See Also:
- Constant Field Values
-
-
Method Detail
-
while_
Repeat<C> while_(Predicate<C> predicate)
The task is executed as long as the given predicate evaluates totrue. Defaults to a precondition which always returnstrue.
-
interval
Repeat<C> interval(long interval)
The interval in milliseconds between the iterations. Defaults to 1000L milliseconds.
-
timeout
Repeat<C> timeout(long timeout)
The timeout in milliseconds for the while loop. Defaults to 10000L milliseconds.
-
-