ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ScheduledExecutor.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ScheduledExecutor.java (file contents):
Revision 1.8 by dl, Wed Jun 11 13:17:21 2003 UTC vs.
Revision 1.9 by dl, Tue Jun 24 14:34:48 2003 UTC

# Line 36 | Line 36 | import java.util.*;
36   * @see Executors
37   *
38   * @spec JSR-166
39 + * @author Doug Lea
40   */
41   public class ScheduledExecutor extends ThreadPoolExecutor {
42  
# Line 49 | Line 50 | public class ScheduledExecutor extends T
50       * A delayed or periodic action.
51       */
52      public static class DelayedTask extends CancellableTask implements Delayed {
53 +        /** Sequence number to break ties FIFO */
54          private final long sequenceNumber;
55 +        /** The time the task is enabled to execute in nanoTime units */
56          private final long time;
57 +        /** The delay forllowing next time, or <= 0 if non-periodic */
58          private final long period;
59 <        private final boolean rateBased; // true if at fixed rate;
60 <                                         // false if fixed delay
59 >        /** true if at fixed rate; false if fixed delay */
60 >        private final boolean rateBased;
61 >
62          /**
63           * Creates a one-shot action with given nanoTime-based trigger time
64           */
# Line 99 | Line 104 | public class ScheduledExecutor extends T
104  
105          /**
106           * Return true if this is a periodic (not a one-shot) action.
107 +         * @return true if periodic
108           */
109          public boolean isPeriodic() {
110              return period > 0;
# Line 106 | Line 112 | public class ScheduledExecutor extends T
112  
113          /**
114           * Returns the period, or zero if non-periodic
115 +         * @return the period
116           */
117          public long getPeriod(TimeUnit unit) {
118              return unit.convert(period, TimeUnit.NANOSECONDS);
# Line 273 | Line 280 | public class ScheduledExecutor extends T
280      }
281  
282      /**
283 <     * Creates and executes a one-shot action that becomes enabled after the given date.
283 >     * Creates and executes a one-shot action that becomes enabled
284 >     * after the given date.
285       * @param command the task to execute.
286       * @param date the time to commence excution.
287       * @return a handle that can be used to cancel the task.
# Line 430 | Line 438 | public class ScheduledExecutor extends T
438      /**
439       * If executed task was periodic, cause the task for the next
440       * period to execute.
441 +     * @param r the task (assumed to be a DelayedTask)
442 +     * @param t the exception
443       */
444      protected void afterExecute(Runnable r, Throwable t) {
445          if (isShutdown())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines