Class DefaultTimeBasedThrottle

  • All Implemented Interfaces:
    Throttle

    public class DefaultTimeBasedThrottle
    extends java.lang.Object
    implements Throttle
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean open​(long threshold)
      以时间为依据打开节流器,上次打开之后必须至少节流了指定时间才能再次打开,如果打开失败返回false。
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultTimeBasedThrottle

        public DefaultTimeBasedThrottle​(long countDelay)
    • Method Detail

      • open

        public boolean open​(long threshold)
        以时间为依据打开节流器,上次打开之后必须至少节流了指定时间才能再次打开,如果打开失败返回false。
        Specified by:
        open in interface Throttle
        Parameters:
        threshold - 阈值的含义由实现类定义,可以是基于时间的,未达到时间阈值无法打开;也可以是基于次数的,未达到次数阈值无法打开。
        Returns:
        打开失败返回false。