Class ListenerRegistry<E extends Event,L extends EventListener<E>>

java.lang.Object
io.atomix.utils.event.ListenerRegistry<E,L>
All Implemented Interfaces:
EventSink<E>, ListenerService<E,L>

public class ListenerRegistry<E extends Event,L extends EventListener<E>> extends Object implements ListenerService<E,L>, EventSink<E>
Base implementation of an event sink and a registry capable of tracking listeners and dispatching events to them as part of event sink processing.
  • Field Details

    • listeners

      protected final Set<L extends EventListener<E>> listeners
      Set of listeners that have registered.
  • Constructor Details

    • ListenerRegistry

      public ListenerRegistry()
  • Method Details

    • addListener

      public void addListener(L listener)
      Description copied from interface: ListenerService
      Adds the specified listener.
      Specified by:
      addListener in interface ListenerService<E extends Event,L extends EventListener<E>>
      Parameters:
      listener - listener to be added
    • removeListener

      public void removeListener(L listener)
      Description copied from interface: ListenerService
      Removes the specified listener.
      Specified by:
      removeListener in interface ListenerService<E extends Event,L extends EventListener<E>>
      Parameters:
      listener - listener to be removed
    • process

      public void process(E event)
      Description copied from interface: EventSink
      Processes the specified event.
      Specified by:
      process in interface EventSink<E extends Event>
      Parameters:
      event - event to be processed
    • reportProblem

      protected void reportProblem(E event, Throwable error)
      Reports a problem encountered while processing an event.
      Parameters:
      event - event being processed
      error - error encountered while processing