aspose file tools*
The moose likes Threads and Synchronization and the fly likes What causes a thread to be interrupted? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "What causes a thread to be interrupted?" Watch "What causes a thread to be interrupted?" New topic
Author

What causes a thread to be interrupted?

Kjeld Sigtermans
Ranch Hand

Joined: Aug 10, 2006
Posts: 125
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

Kjeld Sigtermans - SCJP 1.4 - SCWCD 1.4
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
The stack trace of the InterruptedException may give it a clue where it originated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What causes a thread to be interrupted?