Class IterationTimeBoundedBudget
java.lang.Object
org.apache.camel.support.task.budget.IterationTimeBoundedBudget
- All Implemented Interfaces:
Budget,IterationBudget,TimeBudget
This task budget limits the execution by both a given number of iterations or a maximum amount of time for the
execution. When evaluating the budget, the iteration takes precedence over the time budget (hence why: Iteration Time
Budget).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIterationTimeBoundedBudget(long initialDelay, long interval, int maxIterations, long maxDuration) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the task has budget to continue executing or notelapsed()The amount of time that has elapsed since the budget was created.longDefines an initial delay before running the tasklonginterval()The interval between each task execution (delay between the termination of one execution and the commencement of the next).intThe current number of iterationslongThe maximum length of time that the task can executeintThe maximum number of iterationsbooleannext()Move the task to the next iteration
-
Constructor Details
-
IterationTimeBoundedBudget
public IterationTimeBoundedBudget(long initialDelay, long interval, int maxIterations, long maxDuration)
-
-
Method Details
-
initialDelay
public long initialDelay()Description copied from interface:BudgetDefines an initial delay before running the task- Specified by:
initialDelayin interfaceBudget- Returns:
- the initial delay, in milliseconds, before running the task
-
interval
public long interval()Description copied from interface:BudgetThe interval between each task execution (delay between the termination of one execution and the commencement of the next). -
maxIterations
public int maxIterations()Description copied from interface:IterationBudgetThe maximum number of iterations- Specified by:
maxIterationsin interfaceIterationBudget- Returns:
- the maximum number of iterations
-
iteration
public int iteration()Description copied from interface:BudgetThe current number of iterations -
next
public boolean next()Description copied from interface:BudgetMove the task to the next iteration -
canContinue
public boolean canContinue()Description copied from interface:BudgetWhether the task has budget to continue executing or not- Specified by:
canContinuein interfaceBudget- Returns:
- true if the task can continue or false otherwise
-
maxDuration
public long maxDuration()Description copied from interface:TimeBudgetThe maximum length of time that the task can execute- Specified by:
maxDurationin interfaceTimeBudget- Returns:
- the length of time in milliseconds
-
elapsed
Description copied from interface:BudgetThe 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.
-