Class TimeBoundedBudget
- java.lang.Object
-
- org.apache.camel.support.task.budget.TimeBoundedBudget
-
- All Implemented Interfaces:
Budget
,TimeBudget
public class TimeBoundedBudget extends Object implements TimeBudget
This task budget limits the execution by both a maximum amount of time for the execution.
-
-
Field Summary
Fields Modifier and Type Field Description static long
UNLIMITED_DURATION
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canContinue()
Whether the task has budget to continue executing or notDuration
elapsed()
The amount of time that has elapsed since the budget was created.long
initialDelay()
Defines an initial delay before running the tasklong
interval()
The interval between each task executionlong
maxDuration()
The maximum length of time that the task can executeboolean
next()
Move the task to the next iteration
-
-
-
Field Detail
-
UNLIMITED_DURATION
public static final long UNLIMITED_DURATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
maxDuration
public long maxDuration()
Description copied from interface:TimeBudget
The maximum length of time that the task can execute- Specified by:
maxDuration
in interfaceTimeBudget
- Returns:
- the length of time in milliseconds
-
initialDelay
public long initialDelay()
Description copied from interface:Budget
Defines an initial delay before running the task- Specified by:
initialDelay
in interfaceBudget
- Returns:
- the initial delay, in milliseconds, before running the task
-
interval
public long interval()
Description copied from interface:Budget
The interval between each task execution
-
canContinue
public boolean canContinue()
Description copied from interface:Budget
Whether the task has budget to continue executing or not- Specified by:
canContinue
in interfaceBudget
- Returns:
- true if the task can continue or false otherwise
-
next
public boolean next()
Description copied from interface:Budget
Move the task to the next iteration
-
elapsed
public Duration elapsed()
Description copied from interface:Budget
The amount of time that has elapsed since the budget was created. This can be used to account for the amount of time it took to run a task. The precision should be withing a few microseconds/milliseconds due to the start time being created along with the budget instance. We do so to avoid the overhead of checking it the next or canContinue methods because they could be part of the hot path for some components.
-
-