12-17-2009 04:58 AM
Hi,
I created the following code :
class StateTracker extends TimerTask
{
private Timer timer;
public StateTracker()
{
timer = new Timer();
timer.schedule(this, 5000, 150000 ); // starts after 5seconds repeat the task every 150sec
}
public void run()
....
}
The code runs allright, except, under certain circumstances, the task task stopped after a few periodic run( I suspect is disconnected network ). Is there any API I could use to check if the schedule is still active or not.
I would like to reschedule the timertask if the original schedule has been disrupted.
Solved! Go to Solution.
12-17-2009 05:18 AM
timertasks should not be used for blocking processing. i would suggest to put the real workload into an own thread.
as long as the run code is surrounded with exception handling the execution should continue. there is no method to check if the timer is running correctly.