16 |
|
* and return a task object that can be used to cancel or check |
17 |
|
* execution. The <tt>scheduleAtFixedRate</tt> and |
18 |
|
* <tt>scheduleWithFixedDelay</tt> methods create and execute tasks |
19 |
< |
* that run periodically until cancelled. Commands submitted using |
20 |
< |
* the <tt>execute</tt> method are scheduled with a requested delay of |
21 |
< |
* zero. |
19 |
> |
* that run periodically until cancelled. |
20 |
> |
* |
21 |
> |
* <p> Commands submitted using the {@link Executor#execute} and |
22 |
> |
* {@link ExecutorService} <tt>submit</tt> methods are scheduled with |
23 |
> |
* a requested delay of zero. Zero and negative delays (but not |
24 |
> |
* periods) are also allowed in <tt>schedule</tt> methods, and are |
25 |
> |
* treated as requests for immediate execution. |
26 |
|
* |
27 |
|
* <p>All <t>schedule</tt> methods accept <em>relative</em> delays and |
28 |
|
* periods as arguments, not absolute times or dates. It is a simple |
33 |
|
* TimeUnit.MILLISECONDS)</tt>. Beware however that expiration of a |
34 |
|
* relative delay need not coincide with the current <tt>Date</tt> at |
35 |
|
* which the task is enabled due to network time synchronization |
36 |
< |
* protocols, clock drift, or other factors. Negative relative delays |
33 |
< |
* (but not periods) are allowed in <tt>schedule</tt> methods, and are |
34 |
< |
* treated as requests for immediate execution. |
36 |
> |
* protocols, clock drift, or other factors. |
37 |
|
* |
38 |
|
* @since 1.5 |
39 |
|
* @author Doug Lea |
78 |
|
* @param command the task to execute. |
79 |
|
* @param initialDelay the time to delay first execution. |
80 |
|
* @param period the period between successive executions. |
81 |
< |
* @param unit the time unit of the delay and period parameters |
81 |
> |
* @param unit the time unit of the initialDelay and period parameters |
82 |
|
* @return a Future representing pending completion of the task, |
83 |
|
* and whose <tt>get()</tt> method will throw an exception upon |
84 |
|
* cancellation. |
99 |
|
* @param initialDelay the time to delay first execution. |
100 |
|
* @param delay the delay between the termination of one |
101 |
|
* execution and the commencement of the next. |
102 |
< |
* @param unit the time unit of the delay and delay parameters |
102 |
> |
* @param unit the time unit of the initialDelay and delay parameters |
103 |
|
* @return a Future representing pending completion of the task, |
104 |
|
* and whose <tt>get()</tt> method will throw an exception upon |
105 |
|
* cancellation. |
110 |
|
*/ |
111 |
|
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit); |
112 |
|
|
111 |
– |
/** |
112 |
– |
* Execute command with zero required delay. This has effect |
113 |
– |
* equivalent to <tt>schedule(command, 0, anyUnit)</tt>. |
114 |
– |
* @param command the task to execute |
115 |
– |
* @throws RejectedExecutionException if this task cannot be |
116 |
– |
* accepted for execution. |
117 |
– |
* @throws NullPointerException if command is null |
118 |
– |
*/ |
119 |
– |
public void execute(Runnable command); |
113 |
|
} |