Package net.engio.mbassy.bus
Class AbstractPubSubSupport<T>
java.lang.Object
net.engio.mbassy.bus.AbstractPubSubSupport<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
PubSubSupport<T>
,RuntimeProvider
- Direct Known Subclasses:
AbstractSyncAsyncMessageBus
,SyncMessageBus
The base class for all message bus implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
private final List
<IPublicationErrorHandler> private final MessagePublication.Factory
private final BusRuntime
private final SubscriptionManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MessagePublication
createMessagePublication
(T message) protected MessagePublication.Factory
protected Collection
<Subscription> getSubscriptionsByMessageType
(Class messageType) protected void
void
Subscribe all handlers of the given listener.toString()
boolean
unsubscribe
(Object listener) Immediately remove all registered message handlers (if any) of the given listener.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.engio.mbassy.bus.common.PubSubSupport
publish
-
Field Details
-
errorHandlers
-
publicationFactory
-
subscriptionManager
-
runtime
-
ERROR_HANDLER_MSG
- See Also:
-
-
Constructor Details
-
AbstractPubSubSupport
-
-
Method Details
-
getPublicationFactory
-
getRegisteredErrorHandlers
-
unsubscribe
Description copied from interface:PubSubSupport
Immediately remove all registered message handlers (if any) of the given listener. When this call returns all handlers have effectively been removed and will not receive any messages (provided that running publications (iterators) in other threads have not yet obtained a reference to the listener) A call to this method passing any object that is not subscribed will not have any effect and is silently ignored.- Specified by:
unsubscribe
in interfacePubSubSupport<T>
- Parameters:
listener
-- Returns:
- true, if the listener was found and successfully removed false otherwise
-
subscribe
Description copied from interface:PubSubSupport
Subscribe all handlers of the given listener. Any listener is only subscribed once -> subsequent subscriptions of an already subscribed listener will be silently ignored- Specified by:
subscribe
in interfacePubSubSupport<T>
- Parameters:
listener
-
-
getRuntime
- Specified by:
getRuntime
in interfaceRuntimeProvider
-
createMessagePublication
-
getSubscriptionsByMessageType
-
handlePublicationError
-
toString
-