---------- Stack trace ----------
java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Unknown Source)
at java.util.Timer.scheduleAtFixedRate(Unknown Source)
at net.invisiblehand.util.ErrorChecker.addErrorSource(ErrorChecker.java:57)
...
- 1. What to do
- 1.a) What to believe
- 2. Do it
Without seeing the code, who can say? Maybe there is a way to evaluate the
timer's state before trying to cancel it. Just at a glance, without reading
your code. :)
--
Paul Lutus
www.arachnoid.com
One problem *could* be if your TimerTask is throwing an unchecked
exception, and then you try to reschedule it, eg:
import java.util.*;
public class Test
{
public static void main (String [] args)
throws Exception
{
Timer t = new Timer ();
t.scheduleAtFixedRate (new TimerTask()
{
public void run()
{
throw new NullPointerException();
}
}, 1000, 1000);
Thread.sleep (5000);
t.scheduleAtFixedRate (new TimerTask()
{
public void run()
{
}
}, 1000, 1000);
}
}
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Jon Skeet <sk...@pobox.com> wrote:
> > I'm getting this exception in a class of mine which uses a
> > java.util.Timer. The thing is I'm not canceling the Timer. There's
> > no call to cancel() anywhere in my code.
...