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.
  • Method Details

    • nanoTime

      long nanoTime()
      Returns a monotonic nanosecond counter, compared using differences, like System.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 runs
      task - the task to run
      Returns:
      a handle that cancels the task