public class ForegroundTask extends Object implements BlockingTask
| Modifier and Type | Class and Description |
|---|---|
static class |
ForegroundTask.ForegroundTaskBuilder
A builder helper for building new foreground tasks
|
| Modifier and Type | Method and Description |
|---|---|
Duration |
elapsed()
How long it took to run the task
|
boolean |
run(BooleanSupplier supplier)
Run the task
|
<T> boolean |
run(Predicate<T> predicate,
T payload)
Run the task
|
<T> Optional<T> |
run(Supplier<T> supplier,
Predicate<T> predicate)
Run a task until it produces a result
|
public <T> boolean run(Predicate<T> predicate, T payload)
BlockingTaskrun in interface BlockingTaskT - The type of the payload passed to the predicate when testing the taskpredicate - the task as a predicate. The result of the predicate is used to check if the task has completed
or not. The predicate must return true if the execution has completed or false otherwise.
Failures on the task should be handled on the predicate using the payload as wrapper for In/Out
if necessarypayload - a payload to be passed to the taskpublic boolean run(BooleanSupplier supplier)
BlockingTaskrun in interface BlockingTasksupplier - the task as a boolean supplier. The result is used to check if the task has completed or not.
The supplier must return true if the execution has completed or false otherwise.public <T> Optional<T> run(Supplier<T> supplier, Predicate<T> predicate)
T - the type for the resultsupplier - the supplier of the resultpredicate - a predicate to test if the result is acceptableApache Camel