[jboss-cvs] JBossAS SVN: r62625 - projects/test/trunk/src/main/java/org/jboss/test/classloader.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Apr 28 07:06:46 EDT 2007


Author: alesj
Date: 2007-04-28 07:06:46 -0400 (Sat, 28 Apr 2007)
New Revision: 62625

Added:
   projects/test/trunk/src/main/java/org/jboss/test/classloader/TestThread.java
Log:
Copied from [MC's] Classloader project / module.

Added: projects/test/trunk/src/main/java/org/jboss/test/classloader/TestThread.java
===================================================================
--- projects/test/trunk/src/main/java/org/jboss/test/classloader/TestThread.java	                        (rev 0)
+++ projects/test/trunk/src/main/java/org/jboss/test/classloader/TestThread.java	2007-04-28 11:06:46 UTC (rev 62625)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.classloader;
+
+import org.jboss.logging.Logger;
+import junit.framework.AssertionFailedError;
+
+/**
+ * TestThread.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestThread extends Thread implements Thread.UncaughtExceptionHandler
+{
+   private Logger log = Logger.getLogger(TestThread.class);
+
+   private Throwable t;
+
+   public TestThread()
+   {
+      setUncaughtExceptionHandler(this);
+   }
+
+   public TestThread(String name)
+   {
+      super(name);
+      setUncaughtExceptionHandler(this);
+   }
+
+   public void uncaughtException(Thread t, Throwable e)
+   {
+      log.error("Error in thread " + t, e);
+      this.t = e;
+   }
+
+   public void doJoin() throws InterruptedException
+   {
+      super.join();
+      if (t != null)
+      {
+         if (t instanceof AssertionFailedError)
+            throw (AssertionFailedError) t;
+         AssertionFailedError e = new AssertionFailedError("Error in thread" + t);
+         e.initCause(t);
+         throw e;
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list