jakarta-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1067243 - in /jakarta/jmeter/trunk: src/core/org/apache/jmeter/JMeter.java src/core/org/apache/jmeter/engine/StandardJMeterEngine.java xdocs/changes.xml
Date Fri, 04 Feb 2011 17:58:34 GMT
Author: sebb
Date: Fri Feb  4 17:58:33 2011
New Revision: 1067243

URL: http://svn.apache.org/viewvc?rev=1067243&view=rev
Log:
Use Thread.setDefaultUncaughtExceptionHandler() instead of private ThreadGroup

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1067243&r1=1067242&r2=1067243&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Fri Feb  4 17:58:33 2011
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.lang.Thread.UncaughtExceptionHandler;
 import java.net.Authenticator;
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
@@ -295,6 +296,15 @@ public class JMeter implements JMeterPlu
                         , "org.apache.commons.logging.impl.LogKitLogger"); // $NON-NLS-1$
             }
 
+            Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {  
             
+                public void uncaughtException(Thread t, Throwable e) {
+                    if (!(e instanceof ThreadDeath)) {
+                        log.error("Uncaught exception: ", e);
+                        System.err.println("Uncaught Exception " + e + ". See log file for
details.");
+                    }
+                }
+            });
+
             log.info(JMeterUtils.getJMeterCopyright());
             log.info("Version " + JMeterUtils.getJMeterVersion());
             logProperty("java.version"); //$NON-NLS-1$

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java?rev=1067243&r1=1067242&r2=1067243&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java Fri Feb
 4 17:58:33 2011
@@ -169,28 +169,13 @@ public class StandardJMeterEngine implem
         test = testTree;
     }
 
-    // TODO: in Java1.5, perhaps we can use Thread.setDefaultUncaughtExceptionHandler() instead
-    private static class MyThreadGroup extends java.lang.ThreadGroup{
-        public MyThreadGroup(String s) {
-            super(s);
-          }
-
-          @Override
-        public void uncaughtException(Thread t, Throwable e) {
-            if (!(e instanceof ThreadDeath)) {
-                log.error("Uncaught exception: ", e);
-                System.err.println("Uncaught Exception " + e + ". See log file for details.");
-            }
-          }
-    }
-
     public void runTest() throws JMeterEngineException {
         if (host != null){
             long now=System.currentTimeMillis();
             System.out.println("Starting the test on host " + host + " @ "+new Date(now)+"
("+now+")");
         }
         try {
-            Thread runningThread = new Thread(new MyThreadGroup("JMeterThreadGroup"),this);
+            Thread runningThread = new Thread(this, "StandardJMeterEngine");
             runningThread.start();
         } catch (Exception err) {
             stopTest();

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1067243&r1=1067242&r2=1067243&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Feb  4 17:58:33 2011
@@ -202,6 +202,7 @@ Fixed RMI startup to provide location of
 <li>Bug 50008 - Allow BatchSampleSender to be subclassed</li>
 <li>Bug 50450 - use System.array copy in jacobi solver as, being native, is more performant.</li>
 <li>Bug 50487 - runSerialTest verifies objects that never need persisting</li>
+<li>Use Thread.setDefaultUncaughtExceptionHandler() instead of private ThreadGroup</li>
 </ul>
 
 </section> 



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org


Mime
View raw message