T
- type of the listener.public class SingleThreadListenerHandler<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.
Constructor and Description |
---|
SingleThreadListenerHandler(Store<T> listenerStore,
ErrorHandler<T,Exception> errorHandler)
Creates a new listener handler.
|
SingleThreadListenerHandler(Store<T> listenerStore,
ErrorHandler<T,Exception> errorHandler,
boolean stopOnError)
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 SingleThreadListenerHandler(Store<T> listenerStore, ErrorHandler<T,Exception> errorHandler)
listenerStore
- listener store.errorHandler
- error handler used to delegate error handling when
notifying a listener.public SingleThreadListenerHandler(Store<T> listenerStore, ErrorHandler<T,Exception> errorHandler, boolean stopOnError)
listenerStore
- listener store.errorHandler
- error handler used to delegate error handling when
notifying a listener.stopOnError
- boolean to define stop on error behavior.protected void executeCallback(T listener, Invoker<T> invoker)
AbstractListenerHandler
executeCallback
in class AbstractListenerHandler<T>
listener
- Listener to notify.invoker
- Invoker to use.protected void notify(Collection<T> listenersToNotify, Invoker<T> invoker)
notify
in class AbstractListenerHandler<T>
listenersToNotify
- listeners to notify.invoker
- invoker to use.Copyright © 2015. All Rights Reserved.