I have made a custom timertask class by extending the java.util.TimerTask, and a singlton timer class by extending the java.util.Timer (as i need only one timer object).Now what i am doing is scheduling repititivly my custom timertask with the timer object using the method-- timer.schedule(repSchedularObj, delay); Now i want to give user the authority to change the delay so that he/she can reschedule it(by giving a user interface to enter a delay).
Can any one suggest how to do it ?
How to check if previously(before changing the delay) the task is running or not and if running how to get the object of the previously runnig task in order to cancel it ?
Do you really need to cancel a running job? It would seem to make more sense to just schedule the next iteration after the new delay. So you could just call cancel() on the TimerTask (a reference to which you should have stored somewhere), and then schedule it anew.