类 SlidingWindow.Builder<T>

java.lang.Object
com.aizuda.easy.retry.client.common.window.SlidingWindow.Builder<T>
类型参数:
T -
封闭类:
SlidingWindow<T>

public static class SlidingWindow.Builder<T> extends Object
滑动窗口构建器
  • 构造器详细资料

    • Builder

      public Builder()
  • 方法详细资料

    • newBuilder

      public static <T> SlidingWindow.Builder<T> newBuilder()
      创建一个新的构建器
      类型参数:
      T -
      返回:
      this
    • withTotalThreshold

      public SlidingWindow.Builder<T> withTotalThreshold(int totalThreshold)
      总量窗口期阈值
      参数:
      totalThreshold - 总量窗口期阈值
      返回:
      this
    • withWindowTotalThreshold

      public SlidingWindow.Builder<T> withWindowTotalThreshold(int windowTotalThreshold)
      窗口数量预警
      参数:
      windowTotalThreshold - 窗口数量阈值
      返回:
      this
    • withListener

      public SlidingWindow.Builder<T> withListener(Listener<T> listener)
      添加监听器
      参数:
      listener - 监听器
      返回:
      this
    • withDuration

      public SlidingWindow.Builder<T> withDuration(long duration, ChronoUnit chronoUnit)
      添加窗口期时间
      参数:
      duration - 时长
      chronoUnit - 单位
      返回:
      this
    • withScheduledExecutorServiced

      public SlidingWindow.Builder<T> withScheduledExecutorServiced(ScheduledExecutorService threadPoolExecutor)
      添加定时调度线程池
      参数:
      threadPoolExecutor - 线程池对象
      返回:
      this
    • build

      public SlidingWindow<T> build()
      构建滑动窗口对象
      返回:
      SlidingWindow 滑动窗口对象