Interface ListenerBus<L,E>

All Superinterfaces:
org.apache.spark.internal.Logging
All Known Subinterfaces:
SparkListenerBus
All Known Implementing Classes:
AsyncEventQueue

public interface ListenerBus<L,E> extends org.apache.spark.internal.Logging
An event bus which posts events to its listeners.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging

    org.apache.spark.internal.Logging.SparkShellLoggingFilter
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addListener(L listener)
    Add a listener to listen events.
    void
    doPostEvent(L listener, E event)
    Post an event to the specified listener.
    <T extends L>
    scala.collection.Seq<T>
    findListenersByClass(scala.reflect.ClassTag<T> evidence$1)
     
    scala.Option<com.codahale.metrics.Timer>
    getTimer(L listener)
    Returns a CodaHale metrics Timer for measuring the listener's event processing time.
    boolean
    Allows bus implementations to prevent error logging for certain exceptions.
     
    void
    postToAll(E event)
    Post the event to all registered listeners.
     
    void
    Remove all listeners and they won't receive any events.
    void
    removeListener(L listener)
    Remove a listener and it won't receive any events.
    void
    This can be overridden by subclasses if there is any extra cleanup to do when removing a listener.

    Methods inherited from interface org.apache.spark.internal.Logging

    initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq
  • Method Details

    • addListener

      void addListener(L listener)
      Add a listener to listen events. This method is thread-safe and can be called in any thread.
      Parameters:
      listener - (undocumented)
    • doPostEvent

      void doPostEvent(L listener, E event)
      Post an event to the specified listener. onPostEvent is guaranteed to be called in the same thread for all listeners.
      Parameters:
      listener - (undocumented)
      event - (undocumented)
    • findListenersByClass

      <T extends L> scala.collection.Seq<T> findListenersByClass(scala.reflect.ClassTag<T> evidence$1)
    • getTimer

      scala.Option<com.codahale.metrics.Timer> getTimer(L listener)
      Returns a CodaHale metrics Timer for measuring the listener's event processing time. This method is intended to be overridden by subclasses.
      Parameters:
      listener - (undocumented)
      Returns:
      (undocumented)
    • isIgnorableException

      boolean isIgnorableException(Throwable e)
      Allows bus implementations to prevent error logging for certain exceptions.
    • listeners

      List<L> listeners()
    • postToAll

      void postToAll(E event)
      Post the event to all registered listeners. The postToAll caller should guarantee calling postToAll in the same thread for all events.
      Parameters:
      event - (undocumented)
    • redactEvent

      E redactEvent(E e)
    • removeAllListeners

      void removeAllListeners()
      Remove all listeners and they won't receive any events. This method is thread-safe and can be called in any thread.
    • removeListener

      void removeListener(L listener)
      Remove a listener and it won't receive any events. This method is thread-safe and can be called in any thread.
      Parameters:
      listener - (undocumented)
    • removeListenerOnError

      void removeListenerOnError(L listener)
      This can be overridden by subclasses if there is any extra cleanup to do when removing a listener. In particular AsyncEventQueues can clean up queues in the LiveListenerBus.
      Parameters:
      listener - (undocumented)