Search in sources :

Example 1 with Topic

use of com.intellij.util.messages.Topic in project intellij-community by JetBrains.

the class MessageBusConnectionImpl method deliverMessage.

void deliverMessage(@NotNull Message message) {
    final Message messageOnLocalQueue = myPendingMessages.get().poll();
    assert messageOnLocalQueue == message;
    final Topic topic = message.getTopic();
    final Object handler = mySubscriptions.get(topic);
    try {
        Method listenerMethod = message.getListenerMethod();
        if (handler == myDefaultHandler) {
            myDefaultHandler.handle(listenerMethod, message.getArgs());
        } else {
            listenerMethod.invoke(handler, message.getArgs());
        }
    } catch (AbstractMethodError e) {
    //Do nothing. This listener just does not implement something newly added yet.
    } catch (ProcessCanceledException e) {
        throw e;
    } catch (InvocationTargetException e) {
        if (e.getCause() instanceof ProcessCanceledException) {
            throw (ProcessCanceledException) e.getCause();
        }
        LOG.error(e.getCause() == null ? e : e.getCause());
    } catch (Throwable e) {
        LOG.error(e.getCause() == null ? e : e.getCause());
    }
}
Also used : Method(java.lang.reflect.Method) Topic(com.intellij.util.messages.Topic) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Aggregations

ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 Topic (com.intellij.util.messages.Topic)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1