Author: sebb
Date: Mon Apr 20 20:26:03 2009
New Revision: 766856

URL: http://svn.apache.org/viewvc?rev=766856&view=rev
Log:
Tidyup interrupt() handling

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=766856&r1=766855&r2=766856&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 
Mon Apr 20 20:26:03 2009
@@ -519,15 +519,20 @@
 
     /** {...@inheritdoc} */
     public boolean interrupt(){
-        log.warn("Interrupting: " + threadName);
         Sampler samp = currentSampler; // fetch once
         if (samp instanceof Interruptible){
+            log.warn("Interrupting: " + threadName + " sampler: " 
+samp.getName());
             try {
-                ((Interruptible)samp).interrupt();
+                boolean found = ((Interruptible)samp).interrupt();
+                if (!found) { 
+                    log.warn("No operation pending");
+                }
+                return found;
             } catch (Exception e) {
                 log.warn("Caught Exception interrupting sampler: 
"+e.toString());
             }
-            return true;
+        } else if (samp != null){
+            log.warn("Sampler is not Interruptible: "+samp.getName());
         }
         return false;
     }
@@ -669,7 +674,7 @@
                 Thread.sleep(initialDelay);
             } catch (InterruptedException e) {
                 long actual = System.currentTimeMillis() - start;
-                log.warn("Starting delay was interrupted. Waited "+actual+" 
milli-seconds out of "+initialDelay);
+                log.warn("RampUp delay for "+threadName+" was interrupted. 
Waited "+actual+" milli-seconds out of "+initialDelay);
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to