接口 Timer

所有已知实现类:
HashedWheelTimer

public interface Timer
Schedules TimerTasks for one-time future execution in a background thread.

Copy from dubbo, see here for more details.

  • 方法概要

    修饰符和类型
    方法
    说明
    boolean
    the timer is stop
    newTimeout(TimerTask task, long delay, TimeUnit unit)
    Schedules the specified TimerTask for one-time execution after the specified delay.
    Releases all resources acquired by this Timer and cancels all tasks which were scheduled but not executed yet.
  • 方法详细资料

    • newTimeout

      Timeout newTimeout(TimerTask task, long delay, TimeUnit unit)
      Schedules the specified TimerTask for one-time execution after the specified delay.
      参数:
      task - the task to execute
      delay - the time from now to delay execution
      unit - the time unit of the delay parameter
      返回:
      a handle which is associated with the specified task
      抛出:
      IllegalStateException - if this timer has been stopped already
      RejectedExecutionException - if the pending timeouts are too many and creating new timeout can cause instability in the system.
    • stop

      Set<Timeout> stop()
      Releases all resources acquired by this Timer and cancels all tasks which were scheduled but not executed yet.
      返回:
      the handles associated with the tasks which were canceled by this method
    • isStop

      boolean isStop()
      the timer is stop
      返回:
      true for stop