Class SlidingWindow.Builder<T>

java.lang.Object
com.aizuda.snailjob.client.common.window.SlidingWindow.Builder<T>
Type Parameters:
T -
Enclosing class:
SlidingWindow<T>

public static class SlidingWindow.Builder<T> extends Object
滑动窗口构建器
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • newBuilder

      public static <T> SlidingWindow.Builder<T> newBuilder()
      创建一个新的构建器
      Type Parameters:
      T -
      Returns:
      this
    • withTotalThreshold

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

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

      public SlidingWindow.Builder<T> withListener(Listener<T> listener)
      添加监听器
      Parameters:
      listener - 监听器
      Returns:
      this
    • withDuration

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

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

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