Class BasicThreadPool.TimeoutInfo

  • All Implemented Interfaces:
    java.lang.Comparable
    Enclosing class:
    BasicThreadPool

    private static class BasicThreadPool.TimeoutInfo
    extends java.lang.Object
    implements java.lang.Comparable
    An encapsulation of a task and its completion timeout
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeoutInfo​(TaskWrapper wrapper, long timeout)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object o)
      Order TimeoutInfo based on the timestamp at which the task needs to be completed by.
      long getTaskCompletionTimeout()  
      long getTaskCompletionTimeout​(long now)
      Get the time remaining to the complete timeout timestamp in MS.
      (package private) TaskWrapper getTaskWrapper()  
      void setTimeout​(long timeout)  
      boolean stopTask()
      Invoke stopTask on the wrapper and indicate whether this was the first time the task has been notified to stop.
      • Methods inherited from class java.lang.Object

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

      • start

        long start
      • timeoutMS

        long timeoutMS
      • firstStop

        boolean firstStop
    • Constructor Detail

      • TimeoutInfo

        TimeoutInfo​(TaskWrapper wrapper,
                    long timeout)
    • Method Detail

      • setTimeout

        public void setTimeout​(long timeout)
      • compareTo

        public int compareTo​(java.lang.Object o)
        Order TimeoutInfo based on the timestamp at which the task needs to be completed by.
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        o - a TimeoutInfo
        Returns:
        the diff between this timeoutMS and the argument timeoutMS
      • getTaskCompletionTimeout

        public long getTaskCompletionTimeout()
      • getTaskCompletionTimeout

        public long getTaskCompletionTimeout​(long now)
        Get the time remaining to the complete timeout timestamp in MS.
        Parameters:
        now - - the current System.currentTimeMillis value
        Returns:
        the time remaining to the complete timeout timestamp in MS.
      • stopTask

        public boolean stopTask()
        Invoke stopTask on the wrapper and indicate whether this was the first time the task has been notified to stop.
        Returns:
        true if this is the first stopTask, false on the second.