remove "Not delivered events in the queue" assertion causing troubles hard to get rid of (IDEA-198778)

This commit is contained in:
peter
2019-01-31 18:47:18 +01:00
parent d294eea142
commit af641c0feb
2 changed files with 11 additions and 4 deletions
@@ -19,6 +19,7 @@
*/
package com.intellij.util.messages;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
@@ -365,4 +366,13 @@ public class MessageBusTest extends TestCase {
myBus.syncPublisher(TOPIC1).t11();
assertEvents("root 11", "child 11", "root 12", "child 12");
}
public void testTwoHandlersBothDisconnecting() {
Disposable disposable = Disposer.newDisposable();
for (int i = 0; i < 2; i++) {
myBus.connect(disposable).subscribe(RUNNABLE_TOPIC, () -> Disposer.dispose(disposable));
}
myBus.syncPublisher(RUNNABLE_TOPIC).run();
assertTrue(Disposer.isDisposed(disposable));
}
}
@@ -79,12 +79,9 @@ public class MessageBusConnectionImpl implements MessageBusConnection {
@Override
public void dispose() {
Queue<Message> jobs = myPendingMessages.get();
myPendingMessages.get();
myPendingMessages.remove();
myBus.notifyConnectionTerminated(this);
if (!jobs.isEmpty()) {
LOG.error("Not delivered events in the queue: " + jobs);
}
}
@Override