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>
An interface to control the repeated execution of an asynchronous task.
-
Field Summary
Modifier and TypeFieldDescriptionstatic 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 TypeMethodDescriptionfailFast
(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.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 Details
-
DEFAULT_FAIL_FAST
static final boolean DEFAULT_FAIL_FASTBy default, the execution of task fails fast.- See Also:
-
DEFAULT_INTERVAL
static final long DEFAULT_INTERVALBy default, the interval between the iterations is 1 second.- See Also:
-
DEFAULT_TIMEOUT
static final long DEFAULT_TIMEOUTBy default, the timeout for the loop is 10 seconds.- See Also:
-
DEFAULT_ITERATIONS
static final int DEFAULT_ITERATIONSBy default, the number of iterations are infinite.- See Also:
-
-
Method Details
-
while_
The task is executed as long as the given predicate evaluates totrue
. Defaults to a precondition which always returnstrue
. -
failFast
Whether the execution of the task should fail fast or fail last. Defaults to true<C extends FlowContext>. -
interval
The interval in milliseconds between the iterations. Defaults to 1000L<C extends FlowContext> milliseconds. -
timeout
The timeout in milliseconds for the while loop. Defaults to 10000L<C extends FlowContext> milliseconds. -
iterations
The maximal number of iterations of the loop. Defaults to an infinite loop (-1<C extends FlowContext>).
-