T
- type of the listener.public class MultiThreadListenerHandler<T> extends AbstractListenerHandler<T>
At the time when an event takes place a snapshot of the registered listeners is taken and those listeners are notified regardless if they are unregistered before they are actually notified of that particular event.
This listener handler is recommended when the notification rate is high and listeners do not spend too much time processing the notification.
Modifier and Type | Class and Description |
---|---|
static class |
MultiThreadListenerHandler.ThreadingMode
Thread model.
|
Constructor and Description |
---|
MultiThreadListenerHandler(Store<T> listenerStore,
MultiThreadListenerHandler.ThreadingMode threadingMode,
RunnableExecutor taskExecutor,
ErrorHandler<T,Exception> errorHandler)
Creates a new listener handler.
|
Modifier and Type | Method and Description |
---|---|
protected void |
executeCallback(T listener,
Invoker<T> invoker)
Executes a call back method to notify the listener.
|
protected void |
notify(Collection<T> listenersToNotify,
Invoker<T> invoker)
Notifies listeners.
|
errorOccurred, notifyListeners, register, unregister
public MultiThreadListenerHandler(Store<T> listenerStore, MultiThreadListenerHandler.ThreadingMode threadingMode, RunnableExecutor taskExecutor, ErrorHandler<T,Exception> errorHandler)
listenerStore
- listener store.threadingMode
- threading mode.taskExecutor
- task executor.errorHandler
- error handler used to delegate error handling when
notifying a listener.protected void notify(Collection<T> listenersToNotify, Invoker<T> invoker)
AbstractListenerHandler
notify
in class AbstractListenerHandler<T>
listenersToNotify
- listeners to notify.invoker
- invoker to use.protected void executeCallback(T listener, Invoker<T> invoker)
AbstractListenerHandler
executeCallback
in class AbstractListenerHandler<T>
listener
- Listener to notify.invoker
- Invoker to use.Copyright © 2016. All Rights Reserved.