use other thread instead of EDT as an argument to notifyThreadBusy to avoid tests crash

This commit is contained in:
Alexey Kudravtsev
2017-03-15 13:36:22 +03:00
parent b0cea11a74
commit 7ac81ee11f
3 changed files with 13 additions and 1 deletions
@@ -221,7 +221,11 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
gatherStatistics = LOG.isDebugEnabled() || isUnitTestMode() || isInternal();
Thread edt = UIUtil.invokeAndWaitIfNeeded(() -> {
AWTAutoShutdown.getInstance().notifyThreadBusy(Thread.currentThread()); // needed for EDT not to exit suddenly
// instantiate AppDelayQueue which starts "Periodic task thread" which we'll mark busy to prevent this EDT to die
// that thread was chosen because we know for sure it's running
AppScheduledExecutorService service = (AppScheduledExecutorService)AppExecutorUtil.getAppScheduledExecutorService();
Thread thread = service.getPeriodicTasksThread();
AWTAutoShutdown.getInstance().notifyThreadBusy(thread); // needed for EDT not to exit suddenly
return Thread.currentThread();
});
myLock = new ReadMostlyRWLock(edt);
@@ -84,4 +84,8 @@ class AppDelayQueue extends DelayQueue<SchedulingWrapper.MyScheduledFutureTask>
throw new RuntimeException(e);
}
}
Thread getThread() {
return scheduledToPooledTransferer;
}
}
@@ -208,4 +208,8 @@ public class AppScheduledExecutorService extends SchedulingWrapper {
error();
}
}
@NotNull
public Thread getPeriodicTasksThread() {
return delayQueue.getThread();
}
}