This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: java.util.TimerTask
> Do you have a synchronized(this) around this loop?
> Otherwise it might just be throwing MonitorStateExceptions inside the
> loop. Try using Thread.sleep() otherwise.
You're right.
Thread.sleep() works much better in this scenario. Even
though I wouldn't be able to tell why, I see that "we need to use a
mutex in order to prevent MonitorStateExceptions".
Nobody will believe I've said this, let alone, understand what I've just
said :)