类 TimeoutUtils


  • public class TimeoutUtils
    extends java.lang.Object
    A utility class that handles timeouts and is used by the client to retrieve the total timeout of the data. After obtaining the data from the network,totalTime is accumulated. Before obtaining the data from the network, check whether the totalTime is greater than totalTimeout. If yes, it indicates the totalTimeout
    作者:
    leiwen.zh
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      private boolean initialized  
      private long invalidThreshold
      The cumulative expiration time of the time consumed by fetching the data, the unit of ms.
      private long lastResetTime  
      private java.util.concurrent.atomic.AtomicLong totalTime
      Total time to get the data of consumption, the unit of ms.
      private long totalTimeout
      Total timeout to get data, the unit of ms.
    • 构造器概要

      构造器 
      构造器 说明
      TimeoutUtils​(long totalTimeout, long invalidThreshold)  
    • 字段详细资料

      • totalTime

        private final java.util.concurrent.atomic.AtomicLong totalTime
        Total time to get the data of consumption, the unit of ms.
      • lastResetTime

        private volatile long lastResetTime
      • initialized

        private volatile boolean initialized
      • totalTimeout

        private long totalTimeout
        Total timeout to get data, the unit of ms.
      • invalidThreshold

        private long invalidThreshold
        The cumulative expiration time of the time consumed by fetching the data, the unit of ms.
    • 构造器详细资料

      • TimeoutUtils

        public TimeoutUtils​(long totalTimeout,
                            long invalidThreshold)
    • 方法详细资料

      • initLastResetTime

        public void initLastResetTime()
        Init last reset time.
      • addTotalTime

        public void addTotalTime​(long time)
        Cumulative total time.
      • isTimeout

        public boolean isTimeout()
        Is timeout.
      • resetTotalTime

        public void resetTotalTime()
        Clean the total time.
      • getTotalTime

        public java.util.concurrent.atomic.AtomicLong getTotalTime()
      • isTotalTimeExpired

        private boolean isTotalTimeExpired()