Package org.apache.camel.support.task
Class BackgroundTask
java.lang.Object
org.apache.camel.support.task.BackgroundTask
- All Implemented Interfaces:
BlockingTask
,Task
A sleepless blocking task that runs in a Thread the background. The execution is blocked until the task budget is
exhausted. All background tasks are constrained by a time budget.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A builder helper for building new background tasks -
Method Summary
Modifier and TypeMethodDescriptionelapsed()
How long it took to run the taskboolean
run
(BooleanSupplier supplier) Run the taskMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.camel.support.task.BlockingTask
run
-
Method Details
-
run
Description copied from interface:BlockingTask
Run the task- Specified by:
run
in 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.
-
elapsed
Description copied from interface:Task
How long it took to run the task
-