Using interrupt()

Chapter 12 - Exception Callback

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

ExceptionListener Interface
Classes that want to be notified when an exception occurs in an active class can implement the ExceptionListener interface shown in Listing 12.1.
Listing 12.1  ExceptionListener.javaThe Interface to Be Implemented for Exception Callback
1: public interface ExceptionListener {
2:     public void exceptionOccurred(Exception x, Object source);
3: }
This interface declares that classes of the type ExceptionListener must implement an exceptionOccurred() method. An active class will invoke this method on the listener whenever a notable exception should be relayed. The first parameter, x , is a reference to the actual exception. The second parameter, source , is a reference to the active class that caught the exception. Having a reference to the source object allows one ExceptionListener to monitor more than one active object and take a different course of action for each object monitored . If this is not necessary, the source parameter can simply be ignored.

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