Class DeterministicScheduler.ScheduledTask<T>

  • All Implemented Interfaces:
    java.lang.Comparable<java.util.concurrent.Delayed>, java.lang.Runnable, java.util.concurrent.Delayed, java.util.concurrent.Future<T>, java.util.concurrent.ScheduledFuture<T>
    Enclosing class:
    DeterministicScheduler

    private final class DeterministicScheduler.ScheduledTask<T>
    extends java.lang.Object
    implements java.util.concurrent.ScheduledFuture<T>, java.lang.Runnable
    • Constructor Summary

      Constructors 
      Constructor Description
      ScheduledTask​(long repeatDelay, java.lang.Runnable command)  
      ScheduledTask​(java.lang.Runnable command)  
      ScheduledTask​(java.util.concurrent.Callable<T> command)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel​(boolean mayInterruptIfRunning)  
      int compareTo​(java.util.concurrent.Delayed o)  
      T get()  
      T get​(long timeout, java.util.concurrent.TimeUnit unit)  
      long getDelay​(java.util.concurrent.TimeUnit unit)  
      boolean isCancelled()  
      boolean isDone()  
      boolean repeats()  
      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

      • repeatDelay

        public final long repeatDelay
      • command

        public final java.util.concurrent.Callable<T> command
      • isCancelled

        private boolean isCancelled
      • isDone

        private boolean isDone
      • futureResult

        private T futureResult
      • failure

        private java.lang.Exception failure
    • Constructor Detail

      • ScheduledTask

        public ScheduledTask​(java.util.concurrent.Callable<T> command)
      • ScheduledTask

        public ScheduledTask​(java.lang.Runnable command)
      • ScheduledTask

        public ScheduledTask​(long repeatDelay,
                             java.lang.Runnable command)
    • Method Detail

      • toString

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

        public boolean repeats()
      • getDelay

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

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

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<T>
      • get

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

        public T 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<T>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • isCancelled

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

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future<T>
      • run

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