Class AbstractConcurrentEventManager

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Collection _listeners  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(java.lang.Object listener)
      Register an event listener.
      java.lang.Exception[] fireEvent​(java.lang.Object event)
      Fire the given event to all listeners.
      protected abstract void fireEvent​(java.lang.Object event, java.lang.Object listener)
      Implement this method to fire the given event to the given listener.
      java.util.Collection getListeners()
      Return a read-only list of listeners.
      boolean hasListener​(java.lang.Object listener)
      Return whether the given instance is in the list of listeners.
      boolean hasListeners()
      Return true if there are any registered listeners.
      boolean isFailFast()
      Whether to fail after the first exception thrown by any listener.
      protected java.util.Collection newListenerCollection()
      Return a new concurrent container for listeners.
      boolean removeListener​(java.lang.Object listener)
      Remove an event listener.
      void setFailFast​(boolean failFast)
      Whether to fail after the first exception thrown by any listener.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _listeners

        protected final java.util.Collection _listeners
    • Constructor Detail

      • AbstractConcurrentEventManager

        public AbstractConcurrentEventManager()
        Default constructor.
    • Method Detail

      • isFailFast

        public boolean isFailFast()
        Whether to fail after the first exception thrown by any listener.
      • setFailFast

        public void setFailFast​(boolean failFast)
        Whether to fail after the first exception thrown by any listener.
      • addListener

        public void addListener​(java.lang.Object listener)
        Register an event listener.
        Specified by:
        addListener in interface EventManager
      • removeListener

        public boolean removeListener​(java.lang.Object listener)
        Remove an event listener.
        Specified by:
        removeListener in interface EventManager
      • hasListener

        public boolean hasListener​(java.lang.Object listener)
        Return whether the given instance is in the list of listeners.
        Specified by:
        hasListener in interface EventManager
      • hasListeners

        public boolean hasListeners()
        Return true if there are any registered listeners.
        Specified by:
        hasListeners in interface EventManager
      • getListeners

        public java.util.Collection getListeners()
        Return a read-only list of listeners.
        Specified by:
        getListeners in interface EventManager
      • fireEvent

        public java.lang.Exception[] fireEvent​(java.lang.Object event)
        Fire the given event to all listeners.
        Specified by:
        fireEvent in interface EventManager
      • fireEvent

        protected abstract void fireEvent​(java.lang.Object event,
                                          java.lang.Object listener)
                                   throws java.lang.Exception
        Implement this method to fire the given event to the given listener.
        Throws:
        java.lang.Exception
      • newListenerCollection

        protected java.util.Collection newListenerCollection()
        Return a new concurrent container for listeners. Uses a CopyOnWriteArrayList by default.