dispose alarm explicitly to avoid assertions

This commit is contained in:
Eugene Zhuravlev
2012-03-16 13:19:57 +01:00
parent ec1f3e7655
commit c41c1f28f9
@@ -106,25 +106,31 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
invoke(command);
if (currentCommand != null) {
assert !myDisposed;
final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, this);
final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
alarm.addRequest(new Runnable() {
public void run() {
if (currentCommand == myEvents.getCurrentEvent()) {
// if current command is still in progress, cancel it
getCurrentRequest().interrupt();
try {
getCurrentRequest().join();
}
catch (InterruptedException ignored) {
}
catch (Exception e) {
throw new RuntimeException(e);
}
finally {
startNewWorkerThread();
try {
if (currentCommand == myEvents.getCurrentEvent()) {
// if current command is still in progress, cancel it
getCurrentRequest().interrupt();
try {
getCurrentRequest().join();
}
catch (InterruptedException ignored) {
}
catch (Exception e) {
throw new RuntimeException(e);
}
finally {
if (!myDisposed) {
startNewWorkerThread();
}
}
}
}
finally {
Disposer.dispose(alarm);
}
}
}, terminateTimeout);
}