Class TimeScheduler3.Task

  • All Implemented Interfaces:
    java.lang.Comparable<java.util.concurrent.Delayed>, java.lang.Runnable, java.util.concurrent.Delayed, java.util.concurrent.Future
    Direct Known Subclasses:
    TimeScheduler3.RecurringTask
    Enclosing class:
    TimeScheduler3

    public static class TimeScheduler3.Task
    extends java.lang.Object
    implements java.lang.Runnable, java.util.concurrent.Delayed, java.util.concurrent.Future
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean can_block  
      protected boolean cancelled  
      protected long creation_time  
      protected long delay  
      protected boolean done  
      protected java.lang.Runnable runnable  
    • Constructor Summary

      Constructors 
      Constructor Description
      Task​(java.lang.Runnable runnable, boolean can_block)  
      Task​(java.lang.Runnable runnable, long initial_delay, java.util.concurrent.TimeUnit unit, boolean can_block)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canBlock()  
      boolean cancel​(boolean mayInterruptIfRunning)  
      int compareTo​(java.util.concurrent.Delayed o)  
      java.lang.Object get()  
      java.lang.Object get​(long timeout, java.util.concurrent.TimeUnit unit)  
      long getDelay​(java.util.concurrent.TimeUnit unit)  
      java.lang.Runnable getRunnable()  
      boolean isCancelled()  
      boolean isDone()  
      void run()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • runnable

        protected final java.lang.Runnable runnable
      • creation_time

        protected long creation_time
      • delay

        protected long delay
      • cancelled

        protected volatile boolean cancelled
      • done

        protected volatile boolean done
      • can_block

        protected final boolean can_block
    • Constructor Detail

      • Task

        public Task​(java.lang.Runnable runnable,
                    boolean can_block)
      • Task

        public Task​(java.lang.Runnable runnable,
                    long initial_delay,
                    java.util.concurrent.TimeUnit unit,
                    boolean can_block)
    • Method Detail

      • getRunnable

        public java.lang.Runnable getRunnable()
      • canBlock

        public boolean canBlock()
      • compareTo

        public int compareTo​(java.util.concurrent.Delayed o)
        Specified by:
        compareTo in interface java.lang.Comparable<java.util.concurrent.Delayed>
      • getDelay

        public long getDelay​(java.util.concurrent.TimeUnit unit)
        Specified by:
        getDelay in interface java.util.concurrent.Delayed
      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface java.util.concurrent.Future
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future
      • get

        public java.lang.Object get()
                             throws java.lang.InterruptedException,
                                    java.util.concurrent.ExecutionException
        Specified by:
        get in interface java.util.concurrent.Future
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • get

        public java.lang.Object get​(long timeout,
                                    java.util.concurrent.TimeUnit unit)
                             throws java.lang.InterruptedException,
                                    java.util.concurrent.ExecutionException,
                                    java.util.concurrent.TimeoutException
        Specified by:
        get in interface java.util.concurrent.Future
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object