Using setMaxPriority() and getMaxPriority()

Chapter 12 - Exception Callback

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Chapter 12: Exception Callback
Overview
Exceptions can be thrown just about anywhere in a Java program. Methods must declare all of the exceptions they might throw except for RuntimeException and its subclasses. A RuntimeException can occur on just about every line of code (just think of the fact that NullPointerException can be thrown anytime a method is invoked if the object reference s null !).
When an exception occurs and is not immediately caught, it propagates up the call stack until it either is caught by one of the invoking methods, or remains uncaught. For methods called from the main() method, the exception can potentially float all the way back up to main() and get reported there. However, when a new thread is spawned, a brand new call stack is created. This call stack starts with the run() method. The run() method does not declare that it throws any exceptions and should therefore catch all of them.
Many times Java developers are frustrated by the fact that they cannot catch exceptions that occur in other threads. In this chapter, Ill show you a way to pass exceptions that occur inside an active class to another class to signal it that a potential problem has occurred.

Toc


Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors: Paul Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net