diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java index 9143d38890b7..52f48bc28bf4 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java @@ -34,14 +34,14 @@ import com.sun.jdi.VMDisconnectedException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; /** * @author lex */ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread implements DebuggerManagerThread, Disposable { private static final Logger LOG = Logger.getInstance(DebuggerManagerThreadImpl.class); - public static final int COMMAND_TIMEOUT = 3000; + static final int COMMAND_TIMEOUT = 3000; private volatile boolean myDisposed; @@ -55,6 +55,19 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread 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); @@ -106,13 +119,13 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread future = AppExecutorUtil.getAppScheduledExecutorService().schedule( () -> { if (currentCommand == myEvents.getCurrentEvent()) { // if current command is still in progress, cancel it @@ -131,7 +144,10 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread waitForTerminateFutureToComplete(future)); } } @@ -174,7 +190,7 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread