Class EnhancedTimer


  • public class EnhancedTimer
    extends Object
    Specialized timer that can purge tasks in lg(n) time Will only hold a thread while there are pending tasks.
    • Constructor Detail

      • EnhancedTimer

        public EnhancedTimer​(String name)
        Constructs a new Timer that directly executes tasks off of a single-thread thread pool.
        Parameters:
        name -
      • EnhancedTimer

        public EnhancedTimer​(Executor bossExecutor,
                             Executor taskExecutor)
    • Method Detail

      • add

        public EnhancedTimer.Task add​(Runnable task,
                                      long delay)
        Add a delayed task
        Parameters:
        task -
        delay - in ms
        Returns:
        a cancellable Task
      • getQueueSize

        public int getQueueSize()