Hi,

I believe there is a potential bug (Sampler instance null),
and I replaced the ugly System.out with log4j debug output.

Enjoy,
Marcel
Index: src/org/apache/jmeter/threads/JMeterThread.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jmeter/src/org/apache/jmeter/threads/JMeterThread.java,v
retrieving revision 1.17
diff -u -r1.17 JMeterThread.java
--- src/org/apache/jmeter/threads/JMeterThread.java     16 Feb 2002 03:21:42 -0000     
 1.17
+++ src/org/apache/jmeter/threads/JMeterThread.java     24 Apr 2002 10:46:23 -0000
@@ -56,6 +56,8 @@
 
 import java.util.*;
 
+import org.apache.log4j.Category;
+
 import org.apache.jmeter.samplers.SampleListener;
 import org.apache.jmeter.control.NoEntryException;
 import org.apache.jmeter.timers.Timer;
@@ -85,6 +87,9 @@
        private int threadNumberInGroup;
        static Map samplers = new HashMap();
 
+       private transient static Category catClass =
+               Category.getInstance(JMeterThread.class.getName());
+
        /************************************************************
         *  !ToDo (Constructor description)
         ***********************************************************/
@@ -115,30 +120,22 @@
                listeners = controller.getListeners();
                Entry entry = null;
                rampUpDelay();
-               while (running)
-               {
-                       if (!((entry = controller.nextEntry()) instanceof CycleEntry))
+               try {
+                       while (running &&
+                               (entry = controller.nextEntry())!=null )
                        {
-                               delay(timers);
-                               if (entry == null)
-                               {
-                                       running = false;
-                                       break;
-                               }
-                               Sampler sampler = null;
-                               try
+                               if (! (entry instanceof CycleEntry))
                                {
-                                       sampler = getSampler(entry);
+                                       delay(timers);
+                                       Sampler sampler = getSampler(entry);
+                                       SampleResult result = sampler.sample(entry);
+                                       checkAssertions(entry, result);
+                                       notifyListeners(result);
                                }
-                               catch (Exception ex)
-                               {
-                                       ex.printStackTrace();
-                                       running = false;
-                               }
-                               SampleResult result = sampler.sample(entry);
-                               checkAssertions(entry, result);
-                               notifyListeners(result);
                        }
+               } catch (Exception ex)
+               {
+                       ex.printStackTrace();
                }
        }
 
@@ -217,7 +214,11 @@
                        try
                        {
                                Thread.sleep(initialDelay);
-                               System.out.println("Thread #" + (threadNumberInGroup + 
1) + " of " + threads + " now active.");
+                               if(catClass.isDebugEnabled())
+                               {
+                                       catClass.debug("Thread #" + 
+(threadNumberInGroup + 1) +
+                                               " of " + threads + " now active.");
+                               }
                        }
                        catch (InterruptedException e)
                        {

Attachment: msg01505/pgp00000.pgp
Description: PGP signature

Reply via email to