-
passing exceptions from a thread
could somebody tell me how to pass an exception from a thread to its parent class? like i want to do this.
class someClass {
void someMethod throws Exception () {
throw new Exception();
}
}
class anotherClass implements Runnable {
public void run () {
someClass s = new someClass();
s.someMethod();
}
}
its not gonna compile because i've got to try catch s.someMethod(). But i dont want to catch it just then, i want the error to pass to its parent class, which in my case is a gui class to display the error. anybody have ideas on how?
-
Parent class ? What exactly do you mean, If you want the error to be "passed" then
it must be up the calling stack ot by a pointer value.
eschew obfuscation
-
yea what i meant was the calling stack. how do i send the error up the calling stack so i wont have to handle it in the run() method?
-
The run method, when used as target for a runnable, is not part of your programs
regular calling stack, its the java VM that doing the calling.
How come your program/strategy can't handle an exception thrown by a
thread ? I have a feeling that you may be "barking up the wrong tree"
Last edited by sjalle; 06-04-2005 at 10:34 AM.
eschew obfuscation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks