Terminates this timer, discarding any currently scheduled tasks. Does not interfere with a currently executing task (if it exists). Once a timer has been terminated, its execution thread terminates gracefully, and no more tasks may be scheduled on it.
Note that calling this method from within the run method of a timer task that was invoked by this timer absolutely guarantees that the ongoing task execution is the last task execution that will ever be performed by this timer.
This method may be called repeatedly; the second and subsequent calls have no effect.
apigee, a better way to API!
apigee, a better way to API!
Ulf,
The cancellation of timer may be required in the case, where the user does not want to execute any new tasks submitted to this timer.
Originally posted by Ulf Dittmer:
What I was getting at is that, since this is a one-time execution, it does not make sense to use it here.
Furthermore, instead of "t.schedule(sp,0);" and a "Thread.sleep(100)" in the TimerTask, it should be "t.schedule(sp, 100)", which will make things simpler.
apigee, a better way to API!
apigee, a better way to API!