You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/05/26 18:00:35 UTC

svn commit: r409686 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang: Thread.java ThreadGroup.java

Author: tellison
Date: Fri May 26 09:00:35 2006
New Revision: 409686

URL: http://svn.apache.org/viewvc?rev=409686&view=rev
Log:
Implementation of Thread.UncaughtExceptionHandler.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/Thread.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ThreadGroup.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/Thread.java?rev=409686&r1=409685&r2=409686&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/Thread.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/Thread.java Fri May 26 09:00:35 2006
@@ -691,4 +691,22 @@
 		return false;
 	};
 
+    /**
+     * Implemented by objects that want to handle cases where a thread is being
+     * terminated by an uncaught exception.  Upon such termination, the handler is
+     * notified of the terminating thread and causal exception.  If there is no
+     * explicit handler set then the thread's group is the default handler.
+     */
+    public static interface UncaughtExceptionHandler {
+        /**
+         * The thread is being terminated by an uncaught exception.
+         * Further exceptions thrown in this method are prevent the
+         * remainder of the method from executing, but are otherwise
+         * ignored.
+         * 
+         * @param thread the thread that has an uncaught exception
+         * @param ex the exception that was thrown
+         */
+        void uncaughtException(Thread thread, Throwable ex);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ThreadGroup.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ThreadGroup.java?rev=409686&r1=409685&r2=409686&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ThreadGroup.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ThreadGroup.java Fri May 26 09:00:35 2006
@@ -31,7 +31,8 @@
  * @see SecurityManager
  */
 
-public class ThreadGroup {
+public class ThreadGroup implements Thread.UncaughtExceptionHandler {
+
 	// Name of this ThreadGroup
 	private String name;