The Artima Developer Community
Sponsored Link

Java Answers Forum
Exception Handling in Threads

3 replies on 1 page. Most recent reply: Jun 4, 2002 9:11 AM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Josh

Posts: 2
Nickname: jhilge01
Registered: May, 2002

Exception Handling in Threads Posted: May 23, 2002 8:56 AM
Reply to this message Reply
Advertisement
Here's the scenario. An application spawns a thread(T1), which spawns another thread(T2).

If T2 catches an exception. Is it possible to throw it to T1, and ultimately to the application that spawned the thread?

Thanks,
jhilge01


Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Exception Handling in Threads Posted: May 25, 2002 8:04 AM
Reply to this message Reply
Yes,
You could do it !
Either by imoplementing a syntax / protocole to exchange informations between the different elements.
Another option is to use RuntimeExceptions.


Thomas SMETS,
SCJP2 - Brussels

Josh

Posts: 2
Nickname: jhilge01
Registered: May, 2002

Re: Exception Handling in Threads Posted: Jun 4, 2002 8:41 AM
Reply to this message Reply
Maybe .. I'm asking for too much, but SMETS do you have an example of what you mean by

"imoplementing a syntax / protocole to exchange informations between the different elements."

????

Thanks

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Exception Handling in Threads Posted: Jun 4, 2002 9:11 AM
Reply to this message Reply
Check out this thread on threads, just a few posts back in the forum: http://www.artima.com/forums/flat.jsp?forum=1&thread=1113

It passes strings, but it would be just as easy to do the same with an Exception or Throwable object.

Flat View: This topic has 3 replies on 1 page
Topic: BufferedReader - readLine Does not work Previous Topic   Next Topic Topic: bubblesort

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use