another attempt to speedup debugger tests

This commit is contained in:
Alexey Kudravtsev
2017-02-16 10:24:51 +03:00
parent 804313b94d
commit 6c5cd74b33
@@ -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();