ix.util
Class CatchingThread

java.lang.Object
  extended by java.lang.Thread
      extended by ix.util.CatchingThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GroupSender.SendingThread, IQuery.LookupThread, PanelTest.SendingThread, SerializedCommunicationStrategy.ObjectStreamNameServer, SerializedCommunicationStrategy.ObjectStreamServer, TransferThread

public class CatchingThread
extends java.lang.Thread

A thread that catches and reports errors or exceptions.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  java.lang.Runnable innerRunnable
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CatchingThread()
           
CatchingThread(java.lang.Runnable innerRunnable)
           
 
Method Summary
protected  void handleException(java.lang.Throwable except)
          Called by run() if innerRun() throws an exception.
protected  void innerRun()
          Calls the run() method of the innerRunnable passed to the constructor, if innerRunnable is non-null; otherwise does nothing.
 void run()
          Calls innerRun() inside a catch that calls the handleException(Throwable) method on any Throwable caught.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

innerRunnable

java.lang.Runnable innerRunnable
Constructor Detail

CatchingThread

public CatchingThread()

CatchingThread

public CatchingThread(java.lang.Runnable innerRunnable)
Method Detail

run

public void run()
Calls innerRun() inside a catch that calls the handleException(Throwable) method on any Throwable caught.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

innerRun

protected void innerRun()
Calls the run() method of the innerRunnable passed to the constructor, if innerRunnable is non-null; otherwise does nothing. An alternative to supplying an innerRunnable is to redefine this method in a subclass.


handleException

protected void handleException(java.lang.Throwable except)
Called by run() if innerRun() throws an exception. The method supplied by the CatchingThread class calls Debug.displayException(Throwable).