This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Thanks! One more teeny weeny question. Is it possible to throw any exceptions caught in the method called in the 2nd thread back to the caller. I get compile errors when I try this. It says unhandled exception type for the exception I'm catching.
author and iconoclast
You can have a try/catch inside the run() method to handle the exceptions in that second thread, or you can use a callback of some kind. A callback is a method that the second thread can call to report its status. For example, something like
Now, one thing I didn't show is how the first thread knows that the second thread is done. The main way to do that is to use the "wait()" and notify()" methods, but that's another story...
I'm going to move this thread -- which I suspect will get longer -- to the "Threads and Synchronization" forum, and we'll continue it there.