0

In my app I have this simple piece of clock code:

while(!clockRunning){
    time++;
    repaint();
    Thread.sleep(1000);
}
}catch (InterruptedException e){}

and I began curious what situation may cause exception above.

MaciejF
  • 516
  • 1
  • 6
  • 16
  • 1
    [Spurious wakeups](http://stackoverflow.com/questions/1050592/do-spurious-wakeups-actually-happen). More importantly you are either sleeping the EDT or calling `paint()` from a `Thread` that is not the EDT. Both are **very wrong**. – Boris the Spider Jul 14 '14 at 13:44

1 Answers1

0

from the Thread Javadoc :

if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.

basicly when another thread calls this threads interrupt method

schippi
  • 1,034
  • 5
  • 15