Class ListenerManager<T>

  • Type Parameters:
    T - T should be a type of listener

    public class ListenerManager<T>
    extends java.lang.Object
    This class provides the unified way to manager venice listener.
    • Constructor Summary

      Constructors 
      Constructor Description
      ListenerManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void subscribe​(java.lang.String key, T listener)  
      void trigger​(java.lang.String key, java.util.function.Consumer<T> handler)
      Trigger notification and execute the given handler.
      void unsubscribe​(java.lang.String key, T listener)  
      • Methods inherited from class java.lang.Object

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

      • ListenerManager

        public ListenerManager()
    • Method Detail

      • subscribe

        public void subscribe​(java.lang.String key,
                              T listener)
      • unsubscribe

        public void unsubscribe​(java.lang.String key,
                                T listener)
      • trigger

        public void trigger​(java.lang.String key,
                            java.util.function.Consumer<T> handler)
        Trigger notification and execute the given handler.
        Parameters:
        key -
        handler - The function really handle the event. It accepts listener and call the corresponding handle method of this listener.