Interface TimerScheduler
public interface TimerScheduler
Monotonic time and delayed execution. Methods must not block. Callbacks may run inline;
they must be short and must not run application code. Cancellation is best effort, so an
already dispatched callback may still run. The client does not own or close this scheduler.
Runtime exceptions from time reads or scheduling fail the affected operation or connection
and stop automatic reconnection; the client remains reusable through a later
MqttClient.connect(). A failed read for the timing of a MetricsListener event only leaves
that event unreported. Cancellation failures are logged and cleanup continues.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA handle to a task scheduled withschedule(Duration, Runnable). -
Method Summary
Modifier and TypeMethodDescriptionlongnanoTime()Returns a monotonic nanosecond counter, compared using differences, likeSystem.nanoTime().Runs a task once after a nonnegative delay.
-
Method Details
-
nanoTime
long nanoTime()Returns a monotonic nanosecond counter, compared using differences, likeSystem.nanoTime().- Returns:
- a monotonic nanosecond counter, compared using differences, like
System.nanoTime()
-
schedule
Runs a task once after a nonnegative delay.- Parameters:
delay- the delay before the task runstask- the task to run- Returns:
a handle that cancels the task
-