Class AbstractListenerDispatcher<TListener>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(TListener listener)
      Adds the supplied listener to this dispatcher as a strongly referenced listener.
      void addWeakListener​(TListener listener)
      Adds the supplied listener to this dispatcher as a weakly referenced listener.
      boolean isShutdown()  
      java.util.Iterator<TListener> iterator()  
      protected abstract void logError​(java.lang.String message, java.lang.Throwable throwable)  
      protected void notify​(java.util.function.Consumer<TListener> notificationHandler, java.lang.String notificationLogName)  
      void removeAllListeners()
      Removes all listeners from this dispatcher.
      void removeListener​(TListener listener)
      Removes the supplied listener from this dispatcher (both weak and strong).
      void shutdown()
      Shuts down this dispatcher and removes all listeners.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • AbstractListenerDispatcher

        public AbstractListenerDispatcher()
    • Method Detail

      • addListener

        public final void addListener​(TListener listener)
        Adds the supplied listener to this dispatcher as a strongly referenced listener.

        A call to this method has no effect after shutdown() has been called.

        Parameters:
        listener - Listener object
      • addWeakListener

        public final void addWeakListener​(TListener listener)
        Adds the supplied listener to this dispatcher as a weakly referenced listener.

        A call to this method has no effect after shutdown() has been called.

        Attempts to add a listener that is already strongly referenced will be ignored.

        Parameters:
        listener - Listener object
      • removeListener

        public final void removeListener​(TListener listener)
        Removes the supplied listener from this dispatcher (both weak and strong).
        Parameters:
        listener - Listener object
      • notify

        protected final void notify​(java.util.function.Consumer<TListener> notificationHandler,
                                    java.lang.String notificationLogName)
      • logError

        protected abstract void logError​(java.lang.String message,
                                         java.lang.Throwable throwable)
      • removeAllListeners

        public final void removeAllListeners()
        Removes all listeners from this dispatcher.
      • shutdown

        public final void shutdown()
        Shuts down this dispatcher and removes all listeners.

        After shutdown calls to addListener(Object) are ignored.

      • isShutdown

        public final boolean isShutdown()
        Returns:
        true when this dispatcher has been shut down.
      • iterator

        public final java.util.Iterator<TListener> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<TListener>