Package org.apache.camel.util.backoff
Class SimpleBackOffTimer
java.lang.Object
org.apache.camel.util.backoff.SimpleBackOffTimer
- All Implemented Interfaces:
Closeable,AutoCloseable,BackOffTimer
A simple timer utility that use a linked
BackOff to determine when a task should be executed.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.util.backoff.BackOffTimer
BackOffTimer.Task -
Constructor Summary
ConstructorsConstructorDescriptionSimpleBackOffTimer(String name, ScheduledExecutorService scheduler) SimpleBackOffTimer(ScheduledExecutorService scheduler) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops and closes this timer.getName()Gets the name of this timer.getTasks()Access to unmodifiable set of all the tasksvoidremove(BackOffTimer.Task task) Removes the taskschedule(BackOff backOff, ThrowingFunction<BackOffTimer.Task, Boolean, Exception> function) Schedule the given function/task to be executed some time in the future according to the given backOff.intsize()Number of tasks
-
Constructor Details
-
SimpleBackOffTimer
-
SimpleBackOffTimer
-
-
Method Details
-
schedule
public BackOffTimer.Task schedule(BackOff backOff, ThrowingFunction<BackOffTimer.Task, Boolean, Exception> function) Schedule the given function/task to be executed some time in the future according to the given backOff.- Specified by:
schedulein interfaceBackOffTimer- Parameters:
backOff- the settings for how often to run the taskfunction- the function to call for each run- Returns:
- the task
-
getName
Gets the name of this timer.- Specified by:
getNamein interfaceBackOffTimer
-
remove
Removes the task- Specified by:
removein interfaceBackOffTimer
-
getTasks
Access to unmodifiable set of all the tasks- Specified by:
getTasksin interfaceBackOffTimer
-
size
Number of tasks- Specified by:
sizein interfaceBackOffTimer
-
close
Stops and closes this timer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-