Author: sebb
Date: Sat Apr 18 14:20:41 2009
New Revision: 766328

URL: http://svn.apache.org/viewvc?rev=766328&view=rev
Log:
Tidy up further; remove unused method; only set current sampler while actually 
using it

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=766328&r1=766327&r2=766328&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
Sat Apr 18 14:20:41 2009
@@ -259,8 +259,8 @@
         } finally {
             threadContext.clear();
             log.info("Thread finished: " + threadName);
-            monitor.threadFinished(this);
             threadFinished();
+            monitor.threadFinished(this); // Tell the engine we are done
         }
     }
 
@@ -276,7 +276,6 @@
         SampleResult transactionResult = null;
         try {
             threadContext.setCurrentSampler(current);
-            currentSampler = current;
 
             // Check if we are running a transaction
             TransactionSampler transactionSampler = null;
@@ -313,7 +312,6 @@
                     if (current instanceof TransactionSampler){
                         SampleResult res = process_sampler(current, prev, 
threadContext);// recursive call
                         threadContext.setCurrentSampler(prev);
-                        currentSampler = prev;
                         current=null;
                         if (res!=null){
                             transactionSampler.addSubSamplerResult(res);
@@ -338,8 +336,9 @@
                 TestBeanHelper.prepare(sampler);
 
                 // Perform the actual sample
-                SampleResult
-                result = sampler.sample(null);
+                currentSampler = sampler;
+                SampleResult result = sampler.sample(null);
+                currentSampler = null;
                 // TODO: remove this useless Entry parameter
 
                 // If we got any results, then perform processing on the result
@@ -444,12 +443,6 @@
         }
         rampUpDelay();
         log.info("Thread started: " + Thread.currentThread().getName());
-        JMeterContextService.incrNumberOfThreads();
-        threadGroup.incrNumberOfThreads();
-        GuiPackage gp =GuiPackage.getInstance();
-        if (gp != null) {// check there is a GUI
-            gp.getMainFrame().updateCounts();
-        }
         /*
          * Setting SamplingStarted before the contollers are initialised allows
          * them to access the running values of functions and variables 
(however
@@ -466,24 +459,24 @@
         threadStarted();
     }
 
-    /**
-     *
-     */
     private void threadStarted() {
+        JMeterContextService.incrNumberOfThreads();
+        threadGroup.incrNumberOfThreads();
+        GuiPackage gp =GuiPackage.getInstance();
+        if (gp != null) {// check there is a GUI
+            gp.getMainFrame().updateCounts();
+        }
         ThreadListenerTraverser startup = new ThreadListenerTraverser(true);
-        testTree.traverse(startup);
+        testTree.traverse(startup); // call ThreadListener.threadStarted()
     }
 
-    /**
-     *
-     */
     private void threadFinished() {
         ThreadListenerTraverser shut = new ThreadListenerTraverser(false);
-        testTree.traverse(shut);
+        testTree.traverse(shut); // call ThreadListener.threadFinished()
         JMeterContextService.decrNumberOfThreads();
         threadGroup.decrNumberOfThreads();
         GuiPackage gp = GuiPackage.getInstance();
-        if (gp != null){
+        if (gp != null){// check there is a GUI
             gp.getMainFrame().updateCounts();
         }
     }
@@ -733,10 +726,6 @@
         onErrorStopThread = b;
     }
 
-    public ThreadGroup getThreadGroup() {
-        return threadGroup;
-    }
-
     public void setThreadGroup(ThreadGroup group) {
         this.threadGroup = group;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org

Reply via email to