• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread InterruptException Question

 
Chase Bonham
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try {
Thread.sleep(2000)
} catch (InterruptedException e) {

}

Other than external Java thread calling interrupt() explicitly on the Thread
with the above code in it. What else would cause the above code to thrown an InterruptedException?
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't think of anything. I thought interrupting was something done by the Java programmer, not by the Java system.
 
Ben Ethridge
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may help explain:

http://builder.com.com/5100-6370-5144546.html

...and this:

http://www.coderanch.com/t/233581/threads/java/kill-child-thread-its-parent

...though the latter may be more debate than you were looking for.

However, it is somewhat interesting to note that in both of the above, is that one little keyword, the word I've learned to hate seeing, the word that always seems to signal a potential design or coding flaw. And the word is:

"unfortunately".

Ben
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!