You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/04/20 16:47:39 UTC
svn commit: r766713 - in /jakarta/jmeter/trunk:
src/components/org/apache/jmeter/sampler/
src/components/org/apache/jmeter/sampler/gui/
src/core/org/apache/jmeter/resources/ src/core/org/apache/jmeter/threads/
xdocs/ xdocs/images/screenshots/ xdocs/use...
Author: sebb
Date: Mon Apr 20 14:47:39 2009
New Revision: 766713
URL: http://svn.apache.org/viewvc?rev=766713&view=rev
Log:
Test Action now supports "Stop Now" action
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/images/screenshots/test_action.png
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java?rev=766713&r1=766712&r2=766713&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java Mon Apr 20 14:47:39 2009
@@ -39,6 +39,7 @@
// Actions
public final static int STOP = 0;
public final static int PAUSE = 1;
+ public final static int STOP_NOW = 2;
// Action targets
public final static int THREAD = 0;
@@ -66,18 +67,20 @@
int action = getAction();
if (action == PAUSE) {
pause(getDurationAsString());
- } else if (action == STOP) {
+ } else if (action == STOP || action == STOP_NOW) {
if (target == THREAD) {
log.info("Stopping current thread");
context.getThread().stop();
- }
- // Not yet implemented
- // else if (target==THREAD_GROUP)
- // {
- // }
- else if (target == TEST) {
- log.info("Stopping all threads");
- context.getEngine().askThreadsToStop();
+// //Not yet implemented
+// } else if (target==THREAD_GROUP) {
+ } else if (target == TEST) {
+ if (action == STOP_NOW) {
+ log.info("Stopping all threads now");
+ context.getEngine().askThreadsToStopNow();
+ } else {
+ log.info("Stopping all threads");
+ context.getEngine().askThreadsToStop();
+ }
}
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java?rev=766713&r1=766712&r2=766713&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java Mon Apr 20 14:47:39 2009
@@ -48,6 +48,8 @@
private JRadioButton stopButton;
+ private JRadioButton stopNowButton;
+
private JTextField durationField;
// State variables
@@ -71,6 +73,8 @@
private final String stopAction = JMeterUtils.getResString("test_action_stop"); // $NON-NLS-1$
+ private final String stopNowAction = JMeterUtils.getResString("test_action_stop_now"); // $NON-NLS-1$
+
private final String durationLabel = JMeterUtils.getResString("test_action_duration"); // $NON-NLS-1$
public TestActionGui() {
@@ -98,6 +102,8 @@
action = ta.getAction();
if (action == TestAction.PAUSE) {
pauseButton.setSelected(true);
+ } else if (action == TestAction.STOP_NOW) {
+ stopNowButton.setSelected(true);
} else {
stopButton.setSelected(true);
}
@@ -138,7 +144,6 @@
durationString = ""; //$NON-NLS-1$
durationField.setText(""); //$NON-NLS-1$
pauseButton.setSelected(true);
- stopButton.setSelected(false);
action = TestAction.PAUSE;
target = TestAction.THREAD;
@@ -190,11 +195,22 @@
}
}
});
+ stopNowButton = new JRadioButton(stopNowAction, false);
+ stopNowButton.addChangeListener(new ChangeListener() {
+ public void stateChanged(ChangeEvent e) {
+ if (stopNowButton.isSelected()) {
+ action = TestAction.STOP_NOW;
+ durationField.setEnabled(false);
+ }
+ }
+ });
actionButtons.add(pauseButton);
actionButtons.add(stopButton);
+ actionButtons.add(stopNowButton);
actionPanel.add(new JLabel(actionLabel));
actionPanel.add(pauseButton);
actionPanel.add(stopButton);
+ actionPanel.add(stopNowButton);
add(actionPanel);
// Duration
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=766713&r1=766712&r2=766713&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Mon Apr 20 14:47:39 2009
@@ -798,6 +798,7 @@
test_action_duration=Duration (milliseconds)
test_action_pause=Pause
test_action_stop=Stop
+test_action_stop_now=Stop Now
test_action_target=Target
test_action_target_test=All Threads
test_action_target_thread=Current Thread
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=766713&r1=766712&r2=766713&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 14:47:39 2009
@@ -34,6 +34,8 @@
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.processor.PostProcessor;
import org.apache.jmeter.processor.PreProcessor;
+import org.apache.jmeter.protocol.http.sampler.AccessLogSampler;
+import org.apache.jmeter.sampler.TestAction;
import org.apache.jmeter.samplers.Interruptible;
import org.apache.jmeter.samplers.SampleEvent;
import org.apache.jmeter.samplers.SampleListener;
@@ -441,7 +443,7 @@
// set the scheduler to start
startScheduler();
}
- rampUpDelay();
+ rampUpDelay(); // TODO - how to handle thread stopped here
log.info("Thread started: " + Thread.currentThread().getName());
/*
* Setting SamplingStarted before the contollers are initialised allows
@@ -510,7 +512,7 @@
return threadName;
}
- public void stop() { // Called by StandardJMeterEngine
+ public void stop() { // Called by StandardJMeterEngine, TestAction and AccessLogSampler
running = false;
log.info("Stopping: " + threadName);
}
@@ -662,9 +664,12 @@
*/
private void rampUpDelay() {
if (initialDelay > 0) {
+ long start = System.currentTimeMillis();
try {
Thread.sleep(initialDelay);
} catch (InterruptedException e) {
+ long actual = System.currentTimeMillis() - start;
+ log.warn("Starting delay was interrupted. Waited "+actual+" milli-seconds out of "+initialDelay);
}
}
}
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=766713&r1=766712&r2=766713&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Mon Apr 20 14:47:39 2009
@@ -240,6 +240,7 @@
<li>Bug 46636 - rmi ports</li>
<li>Mirror server now supports "X-Sleep" header - if this is set, the responding thread will wait for the specified number of milliseconds</li>
<li>Make some samplers interruptible: HTTP (both), SoapSampler, FTPSampler</li>
+<li>Test Action now supports "Stop Now" action</li>
</ul>
<h3>Non-functional changes</h3>
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/test_action.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/test_action.png?rev=766713&r1=766712&r2=766713&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=766713&r1=766712&r2=766713&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Mon Apr 20 14:47:39 2009
@@ -1310,19 +1310,23 @@
</properties>
</component>
-<component name="Test Action" index="§-num;.1.18" width="351" height="182" screenshot="test_action.png">
+<component name="Test Action" index="§-num;.1.18" width="344" height="181" screenshot="test_action.png">
<description>
The Test Action sampler is a sampler that is intended for use in a conditional controller.
-Rather than generate a sample, the test element eithers pauses - or stops the selected target.
+Rather than generate a sample, the test element eithers pauses or stops the selected target.
<p>This sampler can also be useful in conjunction with the Transaction Controller, as it allows
pauses to be included without needing to generate a sample.
For variable delays, set the pause time to zero, and add a Timer as a child.</p>
+<p>
+The "Stop" action stops the thread or test after completing any samples that are in progress.
+The "Stop Now" action stops the test without waiting for samples to complete; it will interrupt any active samples.
+</p>
</description>
<properties>
<property name="Name" required="">Descriptive name for this element that is shown in the tree.</property>
<property name="Target" required="Yes">Current Thread / All Threads (ignored for Pause)</property>
- <property name="Action" required="Yes">Pause / Stop</property>
- <property name="Duration" required="Yes">How long to pause for (milliseconds)</property>
+ <property name="Action" required="Yes">Pause / Stop / Stop Now</property>
+ <property name="Duration" required="Yes, if Pause is selected">How long to pause for (milliseconds)</property>
</properties>
</component><a href="#">^</a>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org