public class MessageBusImpl extends java.lang.Object implements MessageBus
Disposable.Parent| Constructor and Description |
|---|
MessageBusImpl(MessageBusOwner owner,
MessageBusImpl parentBus) |
| Modifier and Type | Method and Description |
|---|---|
com.intellij.util.messages.impl.MessageBusConnectionImpl |
connect()
Allows to create new connection that is not bound to any
Disposable. |
com.intellij.util.messages.impl.MessageBusConnectionImpl |
connect(Disposable parentDisposable)
Allows to create new connection that is bound to the given
Disposable. |
void |
dispose()
Disposes current bus, i.e.
|
void |
disposeConnection() |
void |
disposeConnectionChildren() |
MessageBus |
getParent()
Message buses can be organised into hierarchies.
|
boolean |
hasUndeliveredEvents(Topic<?> topic) |
boolean |
isDisposed()
Returns true if this bus is disposed.
|
void |
setIgnoreParentLazyListeners(boolean ignoreParentLazyListeners) |
void |
setLazyListeners(java.util.concurrent.ConcurrentMap<java.lang.String,java.util.List<ListenerDescriptor>> map)
Must be a concurrent map, because remove operation may be concurrently performed (synchronized only per topic).
|
void |
setMessageDeliveryListener(MessageDeliveryListener listener) |
<L> L |
syncPublisher(Topic<L> topic)
Allows to retrieve an interface for publishing messages to the target topic.
|
java.lang.String |
toString() |
void |
unsubscribePluginListeners(PluginDescriptor pluginDescriptor) |
public MessageBusImpl(MessageBusOwner owner, MessageBusImpl parentBus)
public void setIgnoreParentLazyListeners(boolean ignoreParentLazyListeners)
public void setLazyListeners(java.util.concurrent.ConcurrentMap<java.lang.String,java.util.List<ListenerDescriptor>> map)
public MessageBus getParent()
MessageBusbroadcasting.
Current method exposes parent bus (if any is defined).getParent in interface MessageBuspublic java.lang.String toString()
toString in class java.lang.Objectpublic com.intellij.util.messages.impl.MessageBusConnectionImpl connect()
MessageBusDisposable.connect in interface MessageBuspublic com.intellij.util.messages.impl.MessageBusConnectionImpl connect(Disposable parentDisposable)
MessageBusDisposable. That means that returned connection
will be automatically released if given disposable parent is collected.connect in interface MessageBusparentDisposable - target parent disposable to which life cycle newly created connection shall be boundpublic <L> L syncPublisher(Topic<L> topic)
MessageBusconnections within the target message bus and
subscribe to the target topics;
business interface of the target topic. Every method call on that
object is dispatched by the messaging infrastructure to the subscribers.
broadcasting is performed if necessary as well;
Subscriber1 and subscriber2 are registered for the same topic within
the same message bus;
Message1 is sent to that topic within the same message bus;Message1 is queued for delivery to both subscribers;Message1 is being delivered to the subscriber1;Subscriber1 sends message2 to the same topic within the same bus;subscriber2 is being notified about all queued but not delivered messages,
i.e. its callback is invoked for the message1;
message1;Message2 is queued for delivery to both subscribers;Subscriber1 is notified on message2Subscriber2 is notified on message2'per-topic' manner.
That means that caller of this method is not obliged to keep returned reference along with the reference to the message for
further publishing. It's enough to keep reference to the message bus only and publish
like 'messageBus.syncPublisher(targetTopic).targetMethod()'.syncPublisher in interface MessageBusL - business interface of the target topictopic - target topicpublic void unsubscribePluginListeners(PluginDescriptor pluginDescriptor)
public final void disposeConnectionChildren()
public final void disposeConnection()
public final void dispose()
MessageBusconnections.dispose in interface Disposabledispose in interface MessageBuspublic boolean isDisposed()
MessageBusisDisposed in interface MessageBuspublic boolean hasUndeliveredEvents(Topic<?> topic)
hasUndeliveredEvents in interface MessageBuspublic void setMessageDeliveryListener(MessageDeliveryListener listener)