Package org.apache.camel.support.task
Class ForegroundTask
java.lang.Object
org.apache.camel.support.task.ForegroundTask
- All Implemented Interfaces:
BlockingTask,Task
Runs a task in the foreground, executing for a given number of iteration and sleeping between each of them.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder helper for building new foreground tasks -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.support.task.BlockingTask
run
-
Method Details
-
run
Description copied from interface:BlockingTaskRun the task- Specified by:
runin interfaceBlockingTask- Parameters:
supplier- 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.- Returns:
- true if the task has completed successfully or false if: 1) the budget is exhausted or 2) the task was interrupted.
-
run
Run a task until it produces a result- Type Parameters:
T- the type for the result- Parameters:
supplier- the supplier of the resultpredicate- a predicate to test if the result is acceptable- Returns:
- An optional with the result
-
elapsed
Description copied from interface:TaskHow long it took to run the task
-