< prev index next >

src/java.base/share/classes/java/util/TimerTask.java

Print this page

        

*** 100,110 **** * execution and has not yet run, or has not yet been scheduled, it will * never run. If the task has been scheduled for repeated execution, it * will never run again. (If the task is running when this call occurs, * the task will run to completion, but will never run again.) * ! * <p>Note that calling this method from within the <tt>run</tt> method of * a repeating timer task absolutely guarantees that the timer task will * not run again. * * <p>This method may be called repeatedly; the second and subsequent * calls have no effect. --- 100,110 ---- * execution and has not yet run, or has not yet been scheduled, it will * never run. If the task has been scheduled for repeated execution, it * will never run again. (If the task is running when this call occurs, * the task will run to completion, but will never run again.) * ! * <p>Note that calling this method from within the {@code run} method of * a repeating timer task absolutely guarantees that the timer task will * not run again. * * <p>This method may be called repeatedly; the second and subsequent * calls have no effect.
*** 112,122 **** * @return true if this task is scheduled for one-time execution and has * not yet run, or this task is scheduled for repeated execution. * Returns false if the task was scheduled for one-time execution * and has already run, or if the task was never scheduled, or if * the task was already cancelled. (Loosely speaking, this method ! * returns <tt>true</tt> if it prevents one or more scheduled * executions from taking place.) */ public boolean cancel() { synchronized(lock) { boolean result = (state == SCHEDULED); --- 112,122 ---- * @return true if this task is scheduled for one-time execution and has * not yet run, or this task is scheduled for repeated execution. * Returns false if the task was scheduled for one-time execution * and has already run, or if the task was never scheduled, or if * the task was already cancelled. (Loosely speaking, this method ! * returns {@code true} if it prevents one or more scheduled * executions from taking place.) */ public boolean cancel() { synchronized(lock) { boolean result = (state == SCHEDULED);
< prev index next >