Class IterationBoundedBudget
- java.lang.Object
-
- org.apache.camel.support.task.budget.IterationBoundedBudget
-
- All Implemented Interfaces:
Budget
,IterationBudget
public class IterationBoundedBudget extends Object implements IterationBudget
This task budget limits the execution by a given number of iterations or an unlimited number if configured to do so.
-
-
Field Summary
Fields Modifier and Type Field Description static int
UNLIMITED_ITERATIONS
Defines an "unlimited" number of iterations
-
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 executionint
iteration()
The current number of iterationsint
maxIterations()
The maximum number of iterationsboolean
next()
Move the task to the next iteration
-
-
-
Field Detail
-
UNLIMITED_ITERATIONS
public static final int UNLIMITED_ITERATIONS
Defines an "unlimited" number of iterations- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
maxIterations
public int maxIterations()
Description copied from interface:IterationBudget
The maximum number of iterations- Specified by:
maxIterations
in interfaceIterationBudget
- Returns:
- the maximum number of iterations
-
iteration
public int iteration()
Description copied from interface:IterationBudget
The current number of iterations- Specified by:
iteration
in interfaceIterationBudget
- Returns:
- the current number of iterations
-
next
public boolean next()
Description copied from interface:Budget
Move the task to the next iteration
-
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
-
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.
-
-