Package org.apache.spark.util
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 TypeMethodDescriptionvoid
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>
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
Post the event to all registered listeners.redactEvent
(E e) 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
removeListenerOnError
(L listener) 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
Add a listener to listen events. This method is thread-safe and can be called in any thread.- Parameters:
listener
- (undocumented)
-
doPostEvent
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
-
getTimer
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
Allows bus implementations to prevent error logging for certain exceptions. -
listeners
-
postToAll
Post the event to all registered listeners. ThepostToAll
caller should guarantee callingpostToAll
in the same thread for all events.- Parameters:
event
- (undocumented)
-
redactEvent
-
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
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
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)
-