Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What causes a thread to be interrupted?

 
Kjeld Sigtermans
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When running my code, at some point an InterruptedException is thrown during the execution of a Thread.sleep(...) instruction.
I have not explicitly interrupted the thread. I understand a thread is interrupted when its interrupt() method is called.
The big question is: what has caused my thread to be interrupted during its peaceful nap. Iow what can cause a thread to be interrupted? In this case, who has interrupted my thread?

Cheers,
Kjeld
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stack trace of the InterruptedException may give it a clue where it originated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic