File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed
testng-eclipse-plugin/src/main/org/testng/eclipse/ui Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change 88import java .util .HashSet ;
99import java .util .List ;
1010import java .util .Set ;
11+ import java .util .concurrent .BlockingQueue ;
12+ import java .util .concurrent .LinkedBlockingDeque ;
1113
1214import org .eclipse .core .commands .AbstractHandler ;
1315import org .eclipse .core .commands .ExecutionEvent ;
@@ -209,6 +211,30 @@ public class TestRunnerViewPart extends ViewPart
209211 // MAX_TEXT_SIZE_THRESHOLD.
210212 private static final int MAX_RESULTS_THRESHOLD = 1000 ;
211213 private static final int MAX_TEXT_SIZE_THRESHOLD = 3 ;
214+
215+ private static final BlockingQueue <Runnable > SYNC_RUNNABLE_QUEUE = new LinkedBlockingDeque <>();
216+
217+ static {
218+ Thread t = new Thread () {
219+ @ Override
220+ public void run () {
221+ while (true ) {
222+ try {
223+ Runnable runnable = SYNC_RUNNABLE_QUEUE .take ();
224+ runnable .run ();
225+ } catch (InterruptedException ex ) {
226+ TestNGPlugin .log (ex );
227+ break ;
228+ } catch (RuntimeException ex ) {
229+ TestNGPlugin .log (ex );
230+ }
231+ }
232+ }
233+ };
234+ t .setName ("testng-sync-runnable-executor" ); //$NON-NLS-1$
235+ t .setDaemon (true );
236+ t .start ();
237+ }
212238
213239 /** Infos for the current suite run. */
214240 private SuiteRunInfo currentSuiteRunInfo ;
@@ -584,9 +610,11 @@ public synchronized void dispose() {
584610 }
585611
586612 private void postSyncRunnable (Runnable r ) {
587- if (!isDisposed ()) {
588- getDisplay ().syncExec (r );
589- }
613+ SYNC_RUNNABLE_QUEUE .add (() -> {
614+ if (!isDisposed ()) {
615+ getDisplay ().syncExec (r );
616+ }
617+ });
590618 }
591619
592620 private void postAsyncRunnable (Runnable r ) {
You can’t perform that action at this time.
0 commit comments