Author: sebb
Date: Mon May 28 17:41:39 2012
New Revision: 1343332
URL: http://svn.apache.org/viewvc?rev=1343332&view=rev
Log:
Bug 53310 - TestAction should implement Interruptible
Modified:
jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java?rev=1343332&r1=1343331&r2=1343332&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java Mon
May 28 17:41:39 2012
@@ -24,6 +24,7 @@ import java.util.Set;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.samplers.AbstractSampler;
import org.apache.jmeter.samplers.Entry;
+import org.apache.jmeter.samplers.Interruptible;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.property.IntegerProperty;
@@ -38,7 +39,7 @@ import org.apache.log.Logger;
* intended for use in Conditional Controllers.
*
*/
-public class TestAction extends AbstractSampler {
+public class TestAction extends AbstractSampler implements Interruptible {
private static final Logger log = LoggingManager.getLoggerForClass();
@@ -64,6 +65,8 @@ public class TestAction extends Abstract
private final static String ACTION = "ActionProcessor.action";
//$NON-NLS-1$
private final static String DURATION = "ActionProcessor.duration";
//$NON-NLS-1$
+ private volatile transient Thread pauseThread;
+
public TestAction() {
super();
}
@@ -112,9 +115,12 @@ public class TestAction extends Abstract
milis=0;
}
try {
+ pauseThread = Thread.currentThread();
Thread.sleep(milis);
} catch (InterruptedException e) {
// NOOP
+ } finally {
+ pauseThread = null;
}
}
@@ -150,4 +156,13 @@ public class TestAction extends Abstract
String guiClass =
configElement.getProperty(TestElement.GUI_CLASS).getStringValue();
return APPLIABLE_CONFIG_CLASSES.contains(guiClass);
}
+
+ public boolean interrupt() {
+ Thread thrd = pauseThread; // take copy so cannot get NPE
+ if (thrd!= null) {
+ thrd.interrupt();
+ return true;
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1343332&r1=1343331&r2=1343332&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Mon May 28 17:41:39 2012
@@ -99,6 +99,7 @@ or a Debug Sampler with all fields set t
<h3>Other samplers</h3>
<ul>
+<li>Bug 53310 - TestAction should implement Interruptible</li>
</ul>
<h3>Controllers</h3>