Package org.apache.camel.support.task
Interface Task
- All Known Subinterfaces:
BlockingTask
- All Known Implementing Classes:
BackgroundTask
,ForegroundTask
public interface Task
A task defines a piece of code that may be executed - in the foreground or background - within a certain budget that
is specific to the task type.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionelapsed()
How long it took to run the task when the task was completedlong
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()
Optional name of the tasklong
An indication about the time the next attempt will be made.Gets the task status.int
The current number of iterations (such as when the task is being repeated)
-
Method Details
-
getName
String getName()Optional name of the task -
getStatus
Task.Status getStatus()Gets the task status. -
elapsed
Duration elapsed()How long it took to run the task when the task was completed- Returns:
- The duration to execute the task
-
iteration
int iteration()The current number of iterations (such as when the task is being repeated)- Returns:
- the current number of iterations
-
getCurrentDelay
long getCurrentDelay()The current computed delay. -
getCurrentElapsedTime
long getCurrentElapsedTime()The current elapsed time. -
getFirstAttemptTime
long getFirstAttemptTime()The time the first attempt was performed. -
getLastAttemptTime
long getLastAttemptTime()The time the last attempt has been performed. -
getNextAttemptTime
long getNextAttemptTime()An indication about the time the next attempt will be made. -
getException
Throwable getException()The task failed for some un-expected exception
-