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 TypeMethodDescriptionvoid
cancel()
Cancel the task.The back-off associated with this task.long
The number of attempts so far.long
The current computed delay.long
The current elapsed time.The task failed for some un-expected exceptionlong
The time the first attempt was performed.long
The time the last attempt has been performed.getName()
Name of this tasklong
An indication about the time the next attempt will be made.Gets the task status.long
next()
Return the number of milliseconds to wait before retrying the operation or $BackOff.NEVER
to indicate that no further attempt should be made.void
reset()
Reset the task.void
run()
toString()
void
whenComplete
(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.Task
Name of this task- Specified by:
getName
in interfaceBackOffTimer.Task
-
getBackOff
Description copied from interface:BackOffTimer.Task
The back-off associated with this task.- Specified by:
getBackOff
in interfaceBackOffTimer.Task
-
getStatus
Description copied from interface:BackOffTimer.Task
Gets the task status.- Specified by:
getStatus
in interfaceBackOffTimer.Task
-
getCurrentAttempts
Description copied from interface:BackOffTimer.Task
The number of attempts so far.- Specified by:
getCurrentAttempts
in interfaceBackOffTimer.Task
-
getCurrentDelay
Description copied from interface:BackOffTimer.Task
The current computed delay.- Specified by:
getCurrentDelay
in interfaceBackOffTimer.Task
-
getCurrentElapsedTime
Description copied from interface:BackOffTimer.Task
The current elapsed time.- Specified by:
getCurrentElapsedTime
in interfaceBackOffTimer.Task
-
getFirstAttemptTime
Description copied from interface:BackOffTimer.Task
The time the first attempt was performed.- Specified by:
getFirstAttemptTime
in interfaceBackOffTimer.Task
-
getLastAttemptTime
Description copied from interface:BackOffTimer.Task
The time the last attempt has been performed.- Specified by:
getLastAttemptTime
in interfaceBackOffTimer.Task
-
getNextAttemptTime
Description copied from interface:BackOffTimer.Task
An indication about the time the next attempt will be made.- Specified by:
getNextAttemptTime
in interfaceBackOffTimer.Task
-
getException
Description copied from interface:BackOffTimer.Task
The task failed for some un-expected exception- Specified by:
getException
in interfaceBackOffTimer.Task
-
reset
Description copied from interface:BackOffTimer.Task
Reset the task.- Specified by:
reset
in interfaceBackOffTimer.Task
-
cancel
Description copied from interface:BackOffTimer.Task
Cancel the task.- Specified by:
cancel
in interfaceBackOffTimer.Task
-
whenComplete
Description copied from interface:BackOffTimer.Task
Action to execute when the context is completed (cancelled or exhausted)- Specified by:
whenComplete
in interfaceBackOffTimer.Task
- Parameters:
whenCompleted
- the consumer.
-
run
-
next
Return the number of milliseconds to wait before retrying the operation or $BackOff.NEVER
to indicate that no further attempt should be made. -
toString
-