Interface BackOffTimerFactory
public interface BackOffTimerFactory
SPI factory for creating
BackOffTimer instances used to schedule retry or
back-off tasks.
A BackOffTimer drives retries described by a
BackOff policy (fixed delay, exponential back-off, max elapsed time, etc.)
using a ScheduledExecutorService as the underlying scheduler. Camel's
SupervisingRouteController uses back-off timers to schedule route restart attempts after failure.
The two factory methods cover the common cases: obtain a timer that manages its own scheduler via
newBackOffTimer(String), or supply an externally managed scheduler via
newBackOffTimer(String, java.util.concurrent.ScheduledExecutorService) to share thread pool resources. The
timer must be started and stopped through its service lifecycle.
See Threading Model in the Camel user manual.- Since:
- 4.13
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.util.backoff.BackOffTimernewBackOffTimer(String name) Creates a newBackOffTimer.org.apache.camel.util.backoff.BackOffTimernewBackOffTimer(String name, ScheduledExecutorService scheduler) Creates a newBackOffTimerusing the given executor service.
-
Method Details
-
newBackOffTimer
Creates a newBackOffTimer. Important: The timer should be started and stopped to control its lifecycle by usingServiceHelper.- Parameters:
name- logical name of the timer- Returns:
- new empty backoff timer
-
newBackOffTimer
org.apache.camel.util.backoff.BackOffTimer newBackOffTimer(String name, ScheduledExecutorService scheduler) Creates a newBackOffTimerusing the given executor service. Important: The timer should be started and stopped to control its lifecycle by usingServiceHelper.- Parameters:
name- logical name of the timerscheduler- thread pool to use for running tasks- Returns:
- new empty backoff timer
-