mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test killability, take 2
This commit is contained in:
@@ -316,7 +316,12 @@ public class FileBasedIndex implements ApplicationComponent {
|
||||
ShutDownTracker.getInstance().registerShutdownTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
performShutdown();
|
||||
ShutDownTracker.invokeAndWait(ApplicationManager.getApplication().isUnitTestMode(), false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
performShutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//FileUtil.createIfDoesntExist(workInProgressFile);
|
||||
|
||||
+1
-1
@@ -285,7 +285,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
if (isDisposed() || isDisposeInProgress()) {
|
||||
return;
|
||||
}
|
||||
ShutDownTracker.invokeAndWait(isUnitTestMode(), new Runnable() {
|
||||
ShutDownTracker.invokeAndWait(isUnitTestMode(), true, new Runnable() {
|
||||
public void run() {
|
||||
if (ApplicationManager.getApplication() != ApplicationImpl.this) return;
|
||||
try {
|
||||
|
||||
@@ -735,7 +735,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
ShutDownTracker.getInstance().registerShutdownTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ShutDownTracker.invokeAndWait(true, new Runnable() {
|
||||
ShutDownTracker.invokeAndWait(true, true, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
@@ -133,7 +133,26 @@ public class ShutDownTracker implements Runnable {
|
||||
return list.isEmpty()? null : list.removeLast();
|
||||
}
|
||||
|
||||
public static void invokeAndWait(boolean timed, final Runnable runnable) {
|
||||
public static void invokeAndWait(boolean timed, boolean edt, final Runnable runnable) {
|
||||
if (!edt) {
|
||||
if (!timed) {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
runnable.run();
|
||||
semaphore.up();
|
||||
}
|
||||
}).start();
|
||||
semaphore.waitFor(1000);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (timed) {
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
|
||||
Reference in New Issue
Block a user