• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception propagation and Threads........

 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a normal program follow, if a Runtime Exception is thrown, the application stopped there the further execution, if the exception isn't handled. It's OK. For Example


In the above code, the 4th line won't be executed, because there is a exception is thrown at the line 9.

But for execution of Threads, What is the internal structure of this exception?


For this code, the output is,

run.Exception in thread "Thread-0" java.lang.RuntimeException: Problem.
at ThreadException.run(ThreadException.java:4)
at java.lang.Thread.run(Thread.java:619)
End of Method.


How this exception is handled? Thanks in Advanced!
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The exception is not handled. That's why you got the stack trace. If an exception is not handled, then only the Thread in which the exception occurred is stopped, not the whole JVM. Any other running Threads can continue running in the JVM...
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abimaran Kugathasan wrote:
How this exception is handled?
Thanks in Advanced!



Sorry for that wrong statement, It should be "How this execution happens?

Thanks Ankit for quick replay..
reply
    Bookmark Topic Watch Topic
  • New Topic