jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1722493 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/ src/core/org/apache/jmeter/util/ src/protocol/http/org/apache/jmeter/protocol/http/proxy/ xdocs/
Date Fri, 01 Jan 2016 12:51:21 GMT
Author: fschumacher
Date: Fri Jan  1 12:51:20 2016
New Revision: 1722493

URL: http://svn.apache.org/viewvc?rev=1722493&view=rev
Log:
Make JMeterUtils#runSafe sync/async awt invocation configurable and
change the visualizers to use the async version.

Bugzilla Id: 58784

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/MailerVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/SplineVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
    jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java Fri
Jan  1 12:51:20 2016
@@ -57,7 +57,7 @@ public class AssertionVisualizer extends
         sb.append(sample.getSampleLabel());
         sb.append(getAssertionResult(sample));
         sb.append("\n"); // $NON-NLS-1$
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 synchronized (textArea) {

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java Fri
Jan  1 12:51:20 2016
@@ -60,7 +60,7 @@ public class ComparisonVisualizer extend
 
     @Override
     public void add(final SampleResult sample) {
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(sample);

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java
Fri Jan  1 12:51:20 2016
@@ -108,7 +108,7 @@ public class DistributionGraphVisualizer
 
     @Override
     public void add(final SampleResult res) {
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 // made currentSample volatile

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java Fri Jan
 1 12:51:20 2016
@@ -131,7 +131,7 @@ public class GraphVisualizer extends Abs
 
     @Override
     public void add(final SampleResult res) {
-        JMeterUtils.runSafe(new Runnable() {            
+        JMeterUtils.runSafe(true, new Runnable() {            
             @Override
             public void run() {
                 updateGui(model.addSample(res));

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/MailerVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/MailerVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/MailerVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/MailerVisualizer.java Fri Jan
 1 12:51:20 2016
@@ -122,7 +122,7 @@ public class MailerVisualizer extends Ab
     @Override
     public void add(final SampleResult res) {
         if (getModel() != null) {
-            JMeterUtils.runSafe(new Runnable() {
+            JMeterUtils.runSafe(true, new Runnable() {
                 @Override
                 public void run() {
                     MailerModel model = ((MailerResultCollector) getModel()).getMailerModel();

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
Fri Jan  1 12:51:20 2016
@@ -299,7 +299,7 @@ public class RespTimeGraphVisualizer ext
         if ((matcher == null) || (matcher.find())) {
             final long startTimeMS = sampleResult.getStartTime();
             final long startTimeInterval = startTimeMS / intervalValue;
-            JMeterUtils.runSafe(new Runnable() {
+            JMeterUtils.runSafe(true, new Runnable() {
                 @Override
                 public void run() {
                     synchronized (lock) {

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SplineVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SplineVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SplineVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SplineVisualizer.java Fri Jan
 1 12:51:20 2016
@@ -94,7 +94,7 @@ public class SplineVisualizer extends Ab
 
     @Override
     public void add(final SampleResult res) {
-        JMeterUtils.runSafe(new Runnable() {            
+        JMeterUtils.runSafe(true, new Runnable() {            
             @Override
             public void run() {
                 model.add(res);

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java Fri
Jan  1 12:51:20 2016
@@ -361,7 +361,7 @@ public class StatGraphVisualizer extends
             matcher = pattern.matcher(sampleLabel);
         }
         if ((matcher == null) || (matcher.find())) {
-            JMeterUtils.runSafe(new Runnable() {
+            JMeterUtils.runSafe(true, new Runnable() {
                 @Override
                 public void run() {
                     SamplingStatCalculator row = null;

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java Fri Jan
 1 12:51:20 2016
@@ -114,7 +114,7 @@ public class StatVisualizer extends Abst
 
     @Override
     public void add(final SampleResult res) {
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 SamplingStatCalculator row = null;

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java Fri Jan 
1 12:51:20 2016
@@ -177,7 +177,7 @@ public class SummaryReport extends Abstr
     @Override
     public void add(final SampleResult res) {
         final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 Calculator row = null;

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java Fri Jan
 1 12:51:20 2016
@@ -166,7 +166,7 @@ public class TableVisualizer extends Abs
 
     @Override
     public void add(final SampleResult res) {
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 if (childSamples.isSelected()) {

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
Fri Jan  1 12:51:20 2016
@@ -131,7 +131,7 @@ implements ActionListener, TreeSelection
     /** {@inheritDoc} */
     @Override
     public void add(final SampleResult sample) {
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(true, new Runnable() {
             @Override
             public void run() {
                 updateGui(sample);

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Fri Jan  1 12:51:20 2016
@@ -1306,15 +1306,30 @@ public class JMeterUtils implements Unit
      * @param runnable {@link Runnable}
      */
     public static final void runSafe(Runnable runnable) {
+        runSafe(true, runnable);
+    }
+
+    /**
+     * Run the runnable in AWT Thread if current thread is not AWT thread
+     * otherwise runs call {@link SwingUtilities#invokeAndWait(Runnable)}
+     * @param synchronous flag, whether we will wait for the AWT Thread to finish its job.
+     * @param runnable {@link Runnable}
+     */
+    public static final void runSafe(boolean synchronous, Runnable runnable) {
         if(SwingUtilities.isEventDispatchThread()) {
             runnable.run();
         } else {
-            try {
-                SwingUtilities.invokeAndWait(runnable);
-            } catch (InterruptedException e) {
-                log.warn("Interrupted in thread "+Thread.currentThread().getName(), e);
-            } catch (InvocationTargetException e) {
-                throw new Error(e);
+            if (synchronous) {
+                try {
+                    SwingUtilities.invokeAndWait(runnable);
+                } catch (InterruptedException e) {
+                    log.warn("Interrupted in thread "
+                            + Thread.currentThread().getName(), e);
+                } catch (InvocationTargetException e) {
+                    throw new Error(e);
+                }
+            } else {
+                SwingUtilities.invokeLater(runnable);
             }
         }
     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Fri Jan  1 12:51:20 2016
@@ -846,7 +846,7 @@ public class ProxyControl extends Generi
         final GenericController sc = new GenericController();
         sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
         sc.setName("-------------------"); // $NON-NLS-1$
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(false, new Runnable() {
             @Override
             public void run() {
                 try {
@@ -876,7 +876,7 @@ public class ProxyControl extends Generi
         final GenericController sc = new GenericController();
         sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
         sc.setName(name);
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(false, new Runnable() {
             @Override
             public void run() {
                 try {
@@ -907,7 +907,7 @@ public class ProxyControl extends Generi
         sc.setIncludeTimers(false);
         sc.setProperty(TestElement.GUI_CLASS, TRANSACTION_CONTROLLER_GUI);
         sc.setName(name);
-        JMeterUtils.runSafe(new Runnable() {
+        JMeterUtils.runSafe(false, new Runnable() {
             @Override
             public void run() {
                  try {
@@ -1145,7 +1145,7 @@ public class ProxyControl extends Generi
             final long deltaTFinal = deltaT;
             final boolean firstInBatchFinal = firstInBatch;
             final JMeterTreeNode myTargetFinal = myTarget;
-            JMeterUtils.runSafe(new Runnable() {
+            JMeterUtils.runSafe(false, new Runnable() {
                 @Override
                 public void run() {
                     try {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1722493&r1=1722492&r2=1722493&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Jan  1 12:51:20 2016
@@ -161,6 +161,7 @@ Summary
 <li><bug>58772</bug>Deprecate MongoDB related elements</li>
 <li><bug>58782</bug>ThreadGroup : Improve ergonomy</li>
 <li><bug>58165</bug>Show the time elapsed since the start of the load test
in GUI mode. Partly based on a contribution from Maxime Chassagneux (maxime.chassagneux at
gmail.com)</li>
+<li><bug>58784</bug>Make JMeterUtils#runSafe sync/async awt invocation
configurable and change the visualizers to use the async version.</li>
 </ul>
 <ch_section>Non-functional changes</ch_section>
 <ul>



Mime
View raw message