I want to throw exception in Thread.run() method. How can I do that ?
If I try to compile the Code given below, it does not allow me to compile :
public class ThreadTest {
public static void main(String[] args) {
ThreadTest.DyingThread t = new DyingThread();
t.start();
}
static class DyingThread extends Thread {
public void run() {
try {
//some code that may throw some exception here
} catch (Exception e) {
throw e;//Want to throw(pass) exception to caller
}
}
}
}
Discussions
Web tier: servlets, JSP, Web frameworks: How to throw exception from Thread.run() method to the caller
-
How to throw exception from Thread.run() method to the caller (1 messages)
- Posted by: MURALI P
- Posted on: November 05 2002 15:14 EST
Threaded Messages (1)
- How to throw exception from Thread.run() method to the caller by Palanisamy Gounder on November 05 2002 19:46 EST
-
How to throw exception from Thread.run() method to the caller[ Go to top ]
- Posted by: Palanisamy Gounder
- Posted on: November 05 2002 19:46 EST
- in response to MURALI P
Use UnChecked Exceptions and ThreadGroup.