Thursday, April 24, 2008

Exception handling on a per thread basis

The following applies to Tiger and above. Prior to Tiger, an uncaught exception would propagate from a Thread to its ThreadGroup, propagate up to the root ThreadGroup and print the trace. To circumvent this, we can now implement a nested interface of the Thread class called Thread.UncaughtExceptionHandler. You can create your own implementation of this interface to handle uncaught exceptions.
Note - prior to Tiger, we would have to create our own ThreadGroup, assign any Thread we create to this ThreadGroup and handle the uncaught exception in the ThreadGroup ( a lot of shit for nothing of substance)

The emperor and me beaching

The Devil next door

Kaiser The Emperor