mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
another attempt to speedup debugger tests
This commit is contained in:
@@ -55,19 +55,6 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
|
||||
myDisposed = true;
|
||||
}
|
||||
|
||||
private static void waitForTerminateFutureToComplete(@NotNull Future<?> future) {
|
||||
try {
|
||||
LOG.debug("Waiting for " + future);
|
||||
future.get(1, TimeUnit.MINUTES);
|
||||
}
|
||||
catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
catch (TimeoutException e) {
|
||||
throw new RuntimeException("Termination request is still pending", e);
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static DebuggerManagerThreadImpl createTestInstance(@NotNull Disposable parent, Project project) {
|
||||
return new DebuggerManagerThreadImpl(parent, project);
|
||||
@@ -147,11 +134,18 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
|
||||
}, terminateTimeoutMillis, TimeUnit.MILLISECONDS);
|
||||
|
||||
// register on project instead of this because it would cause significant delays on each session termination otherwise
|
||||
Disposer.register(myProject, () -> waitForTerminateFutureToComplete(future));
|
||||
Disposer.register(myProject, () -> {
|
||||
if (!future.cancel(true)) {
|
||||
WorkerThreadRequest request = getCurrentThreadRequest();
|
||||
if (request != null) {
|
||||
request.requestStop();
|
||||
}
|
||||
}
|
||||
// else scheduled future was de-scheduled successfully before starting
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void processEvent(@NotNull DebuggerCommandImpl managerCommand) {
|
||||
assertIsManagerThread();
|
||||
|
||||
Reference in New Issue
Block a user