View | Details | Raw Unified | Return to bug 58784
Collapse All | Expand All

(-)src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java (-1 / +1 lines)
Lines 57-63 Link Here
57
        sb.append(sample.getSampleLabel());
57
        sb.append(sample.getSampleLabel());
58
        sb.append(getAssertionResult(sample));
58
        sb.append(getAssertionResult(sample));
59
        sb.append("\n"); // $NON-NLS-1$
59
        sb.append("\n"); // $NON-NLS-1$
60
        JMeterUtils.runSafe(new Runnable() {
60
        JMeterUtils.runSafe(true, new Runnable() {
61
            @Override
61
            @Override
62
            public void run() {
62
            public void run() {
63
                synchronized (textArea) {
63
                synchronized (textArea) {
(-)src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java (-1 / +1 lines)
Lines 60-66 Link Here
60
60
61
    @Override
61
    @Override
62
    public void add(final SampleResult sample) {
62
    public void add(final SampleResult sample) {
63
        JMeterUtils.runSafe(new Runnable() {
63
        JMeterUtils.runSafe(true, new Runnable() {
64
            @Override
64
            @Override
65
            public void run() {
65
            public void run() {
66
                DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(sample);
66
                DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(sample);
(-)src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java (-1 / +1 lines)
Lines 108-114 Link Here
108
108
109
    @Override
109
    @Override
110
    public void add(final SampleResult res) {
110
    public void add(final SampleResult res) {
111
        JMeterUtils.runSafe(new Runnable() {
111
        JMeterUtils.runSafe(true, new Runnable() {
112
            @Override
112
            @Override
113
            public void run() {
113
            public void run() {
114
                // made currentSample volatile
114
                // made currentSample volatile
(-)src/components/org/apache/jmeter/visualizers/GraphVisualizer.java (-1 / +1 lines)
Lines 131-137 Link Here
131
131
132
    @Override
132
    @Override
133
    public void add(final SampleResult res) {
133
    public void add(final SampleResult res) {
134
        JMeterUtils.runSafe(new Runnable() {            
134
        JMeterUtils.runSafe(true, new Runnable() {            
135
            @Override
135
            @Override
136
            public void run() {
136
            public void run() {
137
                updateGui(model.addSample(res));
137
                updateGui(model.addSample(res));
(-)src/components/org/apache/jmeter/visualizers/MailerVisualizer.java (-1 / +1 lines)
Lines 122-128 Link Here
122
    @Override
122
    @Override
123
    public void add(final SampleResult res) {
123
    public void add(final SampleResult res) {
124
        if (getModel() != null) {
124
        if (getModel() != null) {
125
            JMeterUtils.runSafe(new Runnable() {
125
            JMeterUtils.runSafe(true, new Runnable() {
126
                @Override
126
                @Override
127
                public void run() {
127
                public void run() {
128
                    MailerModel model = ((MailerResultCollector) getModel()).getMailerModel();
128
                    MailerModel model = ((MailerResultCollector) getModel()).getMailerModel();
(-)src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java (-1 / +1 lines)
Lines 299-305 Link Here
299
        if ((matcher == null) || (matcher.find())) {
299
        if ((matcher == null) || (matcher.find())) {
300
            final long startTimeMS = sampleResult.getStartTime();
300
            final long startTimeMS = sampleResult.getStartTime();
301
            final long startTimeInterval = startTimeMS / intervalValue;
301
            final long startTimeInterval = startTimeMS / intervalValue;
302
            JMeterUtils.runSafe(new Runnable() {
302
            JMeterUtils.runSafe(true, new Runnable() {
303
                @Override
303
                @Override
304
                public void run() {
304
                public void run() {
305
                    synchronized (lock) {
305
                    synchronized (lock) {
(-)src/components/org/apache/jmeter/visualizers/SplineVisualizer.java (-1 / +1 lines)
Lines 94-100 Link Here
94
94
95
    @Override
95
    @Override
96
    public void add(final SampleResult res) {
96
    public void add(final SampleResult res) {
97
        JMeterUtils.runSafe(new Runnable() {            
97
        JMeterUtils.runSafe(true, new Runnable() {            
98
            @Override
98
            @Override
99
            public void run() {
99
            public void run() {
100
                model.add(res);
100
                model.add(res);
(-)src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (-1 / +1 lines)
Lines 361-367 Link Here
361
            matcher = pattern.matcher(sampleLabel);
361
            matcher = pattern.matcher(sampleLabel);
362
        }
362
        }
363
        if ((matcher == null) || (matcher.find())) {
363
        if ((matcher == null) || (matcher.find())) {
364
            JMeterUtils.runSafe(new Runnable() {
364
            JMeterUtils.runSafe(true, new Runnable() {
365
                @Override
365
                @Override
366
                public void run() {
366
                public void run() {
367
                    SamplingStatCalculator row = null;
367
                    SamplingStatCalculator row = null;
(-)src/components/org/apache/jmeter/visualizers/StatVisualizer.java (-1 / +1 lines)
Lines 114-120 Link Here
114
114
115
    @Override
115
    @Override
116
    public void add(final SampleResult res) {
116
    public void add(final SampleResult res) {
117
        JMeterUtils.runSafe(new Runnable() {
117
        JMeterUtils.runSafe(true, new Runnable() {
118
            @Override
118
            @Override
119
            public void run() {
119
            public void run() {
120
                SamplingStatCalculator row = null;
120
                SamplingStatCalculator row = null;
(-)src/components/org/apache/jmeter/visualizers/SummaryReport.java (-1 / +1 lines)
Lines 177-183 Link Here
177
    @Override
177
    @Override
178
    public void add(final SampleResult res) {
178
    public void add(final SampleResult res) {
179
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
179
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
180
        JMeterUtils.runSafe(new Runnable() {
180
        JMeterUtils.runSafe(true, new Runnable() {
181
            @Override
181
            @Override
182
            public void run() {
182
            public void run() {
183
                Calculator row = null;
183
                Calculator row = null;
(-)src/components/org/apache/jmeter/visualizers/TableVisualizer.java (-1 / +1 lines)
Lines 166-172 Link Here
166
166
167
    @Override
167
    @Override
168
    public void add(final SampleResult res) {
168
    public void add(final SampleResult res) {
169
        JMeterUtils.runSafe(new Runnable() {
169
        JMeterUtils.runSafe(true, new Runnable() {
170
            @Override
170
            @Override
171
            public void run() {
171
            public void run() {
172
                if (childSamples.isSelected()) {
172
                if (childSamples.isSelected()) {
(-)src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java (-1 / +1 lines)
Lines 131-137 Link Here
131
    /** {@inheritDoc} */
131
    /** {@inheritDoc} */
132
    @Override
132
    @Override
133
    public void add(final SampleResult sample) {
133
    public void add(final SampleResult sample) {
134
        JMeterUtils.runSafe(new Runnable() {
134
        JMeterUtils.runSafe(true, new Runnable() {
135
            @Override
135
            @Override
136
            public void run() {
136
            public void run() {
137
                updateGui(sample);
137
                updateGui(sample);
(-)src/core/org/apache/jmeter/util/JMeterUtils.java (-6 / +21 lines)
Lines 1306-1320 Link Here
1306
     * @param runnable {@link Runnable}
1306
     * @param runnable {@link Runnable}
1307
     */
1307
     */
1308
    public static final void runSafe(Runnable runnable) {
1308
    public static final void runSafe(Runnable runnable) {
1309
        runSafe(true, runnable);
1310
    }
1311
1312
    /**
1313
     * Run the runnable in AWT Thread if current thread is not AWT thread
1314
     * otherwise runs call {@link SwingUtilities#invokeAndWait(Runnable)}
1315
     * @param synchronous flag, whether we will wait for the AWT Thread to finish its job.
1316
     * @param runnable {@link Runnable}
1317
     */
1318
    public static final void runSafe(boolean synchronous, Runnable runnable) {
1309
        if(SwingUtilities.isEventDispatchThread()) {
1319
        if(SwingUtilities.isEventDispatchThread()) {
1310
            runnable.run();
1320
            runnable.run();
1311
        } else {
1321
        } else {
1312
            try {
1322
            if (synchronous) {
1313
                SwingUtilities.invokeAndWait(runnable);
1323
                try {
1314
            } catch (InterruptedException e) {
1324
                    SwingUtilities.invokeAndWait(runnable);
1315
                log.warn("Interrupted in thread "+Thread.currentThread().getName(), e);
1325
                } catch (InterruptedException e) {
1316
            } catch (InvocationTargetException e) {
1326
                    log.warn("Interrupted in thread "
1317
                throw new Error(e);
1327
                            + Thread.currentThread().getName(), e);
1328
                } catch (InvocationTargetException e) {
1329
                    throw new Error(e);
1330
                }
1331
            } else {
1332
                SwingUtilities.invokeLater(runnable);
1318
            }
1333
            }
1319
        }
1334
        }
1320
    }
1335
    }
(-)src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (-4 / +4 lines)
Lines 846-852 Link Here
846
        final GenericController sc = new GenericController();
846
        final GenericController sc = new GenericController();
847
        sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
847
        sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
848
        sc.setName("-------------------"); // $NON-NLS-1$
848
        sc.setName("-------------------"); // $NON-NLS-1$
849
        JMeterUtils.runSafe(new Runnable() {
849
        JMeterUtils.runSafe(false, new Runnable() {
850
            @Override
850
            @Override
851
            public void run() {
851
            public void run() {
852
                try {
852
                try {
Lines 876-882 Link Here
876
        final GenericController sc = new GenericController();
876
        final GenericController sc = new GenericController();
877
        sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
877
        sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
878
        sc.setName(name);
878
        sc.setName(name);
879
        JMeterUtils.runSafe(new Runnable() {
879
        JMeterUtils.runSafe(false, new Runnable() {
880
            @Override
880
            @Override
881
            public void run() {
881
            public void run() {
882
                try {
882
                try {
Lines 907-913 Link Here
907
        sc.setIncludeTimers(false);
907
        sc.setIncludeTimers(false);
908
        sc.setProperty(TestElement.GUI_CLASS, TRANSACTION_CONTROLLER_GUI);
908
        sc.setProperty(TestElement.GUI_CLASS, TRANSACTION_CONTROLLER_GUI);
909
        sc.setName(name);
909
        sc.setName(name);
910
        JMeterUtils.runSafe(new Runnable() {
910
        JMeterUtils.runSafe(false, new Runnable() {
911
            @Override
911
            @Override
912
            public void run() {
912
            public void run() {
913
                 try {
913
                 try {
Lines 1145-1151 Link Here
1145
            final long deltaTFinal = deltaT;
1145
            final long deltaTFinal = deltaT;
1146
            final boolean firstInBatchFinal = firstInBatch;
1146
            final boolean firstInBatchFinal = firstInBatch;
1147
            final JMeterTreeNode myTargetFinal = myTarget;
1147
            final JMeterTreeNode myTargetFinal = myTarget;
1148
            JMeterUtils.runSafe(new Runnable() {
1148
            JMeterUtils.runSafe(false, new Runnable() {
1149
                @Override
1149
                @Override
1150
                public void run() {
1150
                public void run() {
1151
                    try {
1151
                    try {

Return to bug 58784