Forward Computing and Control Pty. Ltd.
Threads Package V1.0.3

2005/04/11

au.com.forward.threads
Interface ThreadListener

All Superinterfaces:
java.util.EventListener

public interface ThreadListener
extends java.util.EventListener

A listener for thread termination events.

The effectiveness of this interface depends on the use of an outer try/catch block in the thread's run() method and the addition of ThreadReturn.save(Object) statements.  See ThreadReturn for more details.

Author:
matthew ford

Method Summary
 void threadError(ThreadEvent e)
          Called when an error occured on the thread or an error occurred in the observer thread.
 void threadInterrupted(ThreadEvent e)
          Called when the thread was stopped by being interrupted.
 void threadResult(ThreadEvent e)
          Called when the thread died normally.
 

Method Detail

threadResult

void threadResult(ThreadEvent e)
Called when the thread died normally.  Any exception thrown by this method will be passed to threadError(ThreadEvent e).

NOTE:threadResult(ThreadEvent e) should not modify the result Object contained in the ThreadEvent because the same result Object will be passed on to the other registered listeners for this thread.

Parameters:
e - the ThreadEvent

threadInterrupted

void threadInterrupted(ThreadEvent e)
Called when the thread was stopped by being interrupted.  I.e. the thread saved an exception of class InterruptedException or ClosedByInterruptException.  Any exception thrown by this method will be passed to threadError(ThreadEvent e).

NOTE:threadInterrupted(ThreadEvent e) should not modify the result Object contained in the ThreadEvent because the same result Object will be passed on to the other registered listeners for this thread.

Parameters:
e - the ThreadEvent

threadError

void threadError(ThreadEvent e)
Called when an error occured on the thread or an error occurred in the observer thread.  This interface method will also be called if any exception is thrown by threadResult(ThreadEvent e) or threadInterrupted(ThreadEvent e) or by the thread that is monitoring the thread being listened to.

All Throwable objects thrown by this interface method, threadError, are caught and ignored.  It is your responsibility to catch and handle ALL Throwable objects thrown by this method.

Parameters:
e - the ThreadEvent

Forward Computing and Control Pty. Ltd.
Threads Package V1.0.3

2005/04/11

Copyright ©2002-5, Forward Computing and Control Pty. Ltd
ACN 003 669 994   NSW Australia,   All Rights Reserved.