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

public abstract class AbstractPubSubSupport<T> extends Object implements PubSubSupport<T>
The base class for all message bus implementations.
  • Field Details

  • Constructor Details

    • AbstractPubSubSupport

      public AbstractPubSubSupport(IBusConfiguration configuration)
  • Method Details

    • getPublicationFactory

      protected MessagePublication.Factory getPublicationFactory()
    • getRegisteredErrorHandlers

      public Collection<IPublicationErrorHandler> getRegisteredErrorHandlers()
    • unsubscribe

      public boolean unsubscribe(Object listener)
      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 interface PubSubSupport<T>
      Parameters:
      listener -
      Returns:
      true, if the listener was found and successfully removed false otherwise
    • subscribe

      public void subscribe(Object listener)
      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 interface PubSubSupport<T>
      Parameters:
      listener -
    • getRuntime

      public BusRuntime getRuntime()
      Specified by:
      getRuntime in interface RuntimeProvider
    • createMessagePublication

      protected MessagePublication createMessagePublication(T message)
    • getSubscriptionsByMessageType

      protected Collection<Subscription> getSubscriptionsByMessageType(Class messageType)
    • handlePublicationError

      protected void handlePublicationError(PublicationError error)
    • toString

      public String toString()
      Overrides:
      toString in class Object