Class Listeners


  • class Listeners
    extends java.lang.Object
    A thread-safe holder for the listeners
    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • lock

        private final java.util.concurrent.locks.ReentrantReadWriteLock lock
    • Constructor Detail

      • Listeners

        Listeners()
    • Method Detail

      • remove

        <T> boolean remove​(java.lang.Class<T> eventClass,
                           Listener<T> listener)
        Removes the listener listening for the given event if present. It also removes the listeners set from the map if the set is empty.
        Returns:
        true if the listener was present and has been removed
      • remove

        boolean remove​(java.lang.Class<?> eventClass,
                       Listeners.ListenerReferenceHolder listener)
        Removes the listener listening for the given event if present. It also removes the listeners set from the map if the set is empty.
        Returns:
        true if the listener was present and has been removed
      • nullSafeGetListeners

        java.util.List<Listeners.ListenerReferenceHolder> nullSafeGetListeners​(java.lang.Class<?> eventClass)
        Returns:
        A sorted set containing the listeners queue for the given class.