Enum Class TimerManager

java.lang.Object
java.lang.Enum<TimerManager>
org.qiunet.utils.timer.TimerManager
All Implemented Interfaces:
Serializable, Comparable<TimerManager>, Constable

public enum TimerManager extends Enum<TimerManager>
Created by qiunet. 18/1/26
  • Enum Constant Details

    • instance

      public static final TimerManager instance
      自定义的 ScheduledThreadPool 需要调时间有效的, 使用该实例
    • executor

      public static final TimerManager executor
      系统自带的 ScheduledThreadPool
  • Method Details

    • values

      public static TimerManager[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TimerManager valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • executorNow

      public static <V> DFuture<V> executorNow(Runnable callable)
      立刻执行
      Type Parameters:
      V -
      Parameters:
      callable -
      Returns:
    • executorNow

      public static <V> DFuture<V> executorNow(Callable<V> callable)
    • scheduleAtFixedRate

      public ScheduledFuture<?> scheduleAtFixedRate(IScheduledTask timerTask, long delay, long period, TimeUnit unit)
      默认使用毫秒
      Parameters:
      timerTask - 任务
      delay - 延时毫秒
      period - 调度周期
    • scheduleWithDelay

      public <T> DFuture<T> scheduleWithDelay(Runnable delayTask, long delay, TimeUnit unit)
      添加延迟处理任务.
      Type Parameters:
      T -
      Parameters:
      delayTask - 任务
      delay - 延迟参数
      unit - 时间格式
    • scheduleWithDelay

      public <T> DFuture<T> scheduleWithDelay(IDelayTask<T> delayTask, long delay, TimeUnit unit)
    • scheduleWithTimeMillis

      public <T> DFuture<T> scheduleWithTimeMillis(Runnable delayTask, long timeMillis)
    • scheduleWithTimeMillis

      public <T> DFuture<T> scheduleWithTimeMillis(IDelayTask<T> delayTask, long timeMillis)
      在一个指定的时间点执行任务
      Type Parameters:
      T -
      Parameters:
      delayTask -
      timeMillis -
      Returns: