Package org.apache.camel.util.backoff
Class BackOffTimerTask
java.lang.Object
org.apache.camel.util.backoff.BackOffTimerTask
- All Implemented Interfaces:
Runnable,BackOffTimer.Task
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.util.backoff.BackOffTimer.Task
BackOffTimer.Task.Status -
Constructor Summary
ConstructorsConstructorDescriptionBackOffTimerTask(BackOffTimer timer, BackOff backOff, ScheduledExecutorService scheduler, ThrowingFunction<BackOffTimer.Task, Boolean, Exception> function) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel the task.The back-off associated with this task.longThe number of attempts so far.longThe current computed delay.longThe current elapsed time.The task failed for some un-expected exceptionlongThe time the first attempt was performed.longThe time the last attempt has been performed.getName()Name of this tasklongAn indication about the time the next attempt will be made.Gets the task status.longnext()Return the number of milliseconds to wait before retrying the operation or $BackOff.NEVERto indicate that no further attempt should be made.voidreset()Reset the task.voidrun()toString()voidwhenComplete(BiConsumer<BackOffTimer.Task, Throwable> whenCompleted) Action to execute when the context is completed (cancelled or exhausted)
-
Constructor Details
-
BackOffTimerTask
public BackOffTimerTask(BackOffTimer timer, BackOff backOff, ScheduledExecutorService scheduler, ThrowingFunction<BackOffTimer.Task, Boolean, Exception> function)
-
-
Method Details
-
getName
Description copied from interface:BackOffTimer.TaskName of this task- Specified by:
getNamein interfaceBackOffTimer.Task
-
getBackOff
Description copied from interface:BackOffTimer.TaskThe back-off associated with this task.- Specified by:
getBackOffin interfaceBackOffTimer.Task
-
getStatus
Description copied from interface:BackOffTimer.TaskGets the task status.- Specified by:
getStatusin interfaceBackOffTimer.Task
-
getCurrentAttempts
Description copied from interface:BackOffTimer.TaskThe number of attempts so far.- Specified by:
getCurrentAttemptsin interfaceBackOffTimer.Task
-
getCurrentDelay
Description copied from interface:BackOffTimer.TaskThe current computed delay.- Specified by:
getCurrentDelayin interfaceBackOffTimer.Task
-
getCurrentElapsedTime
Description copied from interface:BackOffTimer.TaskThe current elapsed time.- Specified by:
getCurrentElapsedTimein interfaceBackOffTimer.Task
-
getFirstAttemptTime
Description copied from interface:BackOffTimer.TaskThe time the first attempt was performed.- Specified by:
getFirstAttemptTimein interfaceBackOffTimer.Task
-
getLastAttemptTime
Description copied from interface:BackOffTimer.TaskThe time the last attempt has been performed.- Specified by:
getLastAttemptTimein interfaceBackOffTimer.Task
-
getNextAttemptTime
Description copied from interface:BackOffTimer.TaskAn indication about the time the next attempt will be made.- Specified by:
getNextAttemptTimein interfaceBackOffTimer.Task
-
getException
Description copied from interface:BackOffTimer.TaskThe task failed for some un-expected exception- Specified by:
getExceptionin interfaceBackOffTimer.Task
-
reset
Description copied from interface:BackOffTimer.TaskReset the task.- Specified by:
resetin interfaceBackOffTimer.Task
-
cancel
Description copied from interface:BackOffTimer.TaskCancel the task.- Specified by:
cancelin interfaceBackOffTimer.Task
-
whenComplete
Description copied from interface:BackOffTimer.TaskAction to execute when the context is completed (cancelled or exhausted)- Specified by:
whenCompletein interfaceBackOffTimer.Task- Parameters:
whenCompleted- the consumer.
-
run
-
next
Return the number of milliseconds to wait before retrying the operation or $BackOff.NEVERto indicate that no further attempt should be made. -
toString
-