• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

when does the Interrupted Exception is thrown?

 
Ranch Hand
Posts: 228
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When are the threads Interrupted when they are kept in sleep or waiting state..? and when does they throw the checked Interrupted Exception?
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The documentation for InterruptedException describes the situations where it can be thrown. Also, any method that can throw InterruptedException is documented to indicate that fact.
 
Ishan Pandya
Ranch Hand
Posts: 228
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeff Verdegan wrote:The documentation for InterruptedException describes the situations where it can be thrown. Also, any method that can throw InterruptedException is documented to indicate that fact.



I understand but still how is it internally done? as in how the threads are internally interrupted by some other process or some other thread? when does this exception actually occures?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ishan Pandya wrote:

Jeff Verdegan wrote:The documentation for InterruptedException describes the situations where it can be thrown. Also, any method that can throw InterruptedException is documented to indicate that fact.



I understand but still how is it internally done? as in how the threads are internally interrupted by some other process or some other thread?



How is an implementation-specific detail. It's not defined. All that matters is that the behavior observed by our program matches the documentation. Since the JVM controls our threads, it uses whatever thread management context it has to stop the execution and raise the exception.

when does this exception actually occures?



In the situations described in the docs, as I already mentioned. I'm not sure what part of this you're not understanding.
 
Ishan Pandya
Ranch Hand
Posts: 228
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How is an implementation-specific detail. It's not defined. All that matters is that the behavior observed by our program matches the documentation. Since the JVM controls our threads, it uses whatever thread management context it has to stop the execution and raise the exception.



In the situations described in the docs, as I already mentioned. I'm not sure what part of this you're not understanding.



Ya thanks a lot. I got what it is actually..
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic