Class AbstractNotifier<T extends Notification>
- java.lang.Object
-
- io.pravega.client.stream.notifications.notifier.AbstractNotifier<T>
-
- Type Parameters:
T
- notification subtype
- All Implemented Interfaces:
Observable<T>
- Direct Known Subclasses:
AbstractPollingNotifier
public abstract class AbstractNotifier<T extends Notification> extends java.lang.Object implements Observable<T>
AbstractNotifier which is used by all types of Notifiers.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ScheduledExecutorService
executor
protected NotificationSystem
notifySystem
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNotifier(NotificationSystem notifySystem, java.util.concurrent.ScheduledExecutorService executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
registerListener(Listener<T> listener)
Register listener for notification type T.void
unregisterAllListeners()
Remove all listeners for a given type.void
unregisterListener(Listener<T> listener)
Remove a listener.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.pravega.client.stream.notifications.Observable
getType
-
-
-
-
Field Detail
-
notifySystem
protected final NotificationSystem notifySystem
-
executor
protected final java.util.concurrent.ScheduledExecutorService executor
-
-
Constructor Detail
-
AbstractNotifier
protected AbstractNotifier(NotificationSystem notifySystem, java.util.concurrent.ScheduledExecutorService executor)
-
-
Method Detail
-
unregisterListener
public void unregisterListener(Listener<T> listener)
Description copied from interface:Observable
Remove a listener.- Specified by:
unregisterListener
in interfaceObservable<T extends Notification>
- Parameters:
listener
- the listener which needs to be removed.
-
unregisterAllListeners
public void unregisterAllListeners()
Description copied from interface:Observable
Remove all listeners for a given type.- Specified by:
unregisterAllListeners
in interfaceObservable<T extends Notification>
-
registerListener
public void registerListener(Listener<T> listener)
Description copied from interface:Observable
Register listener for notification type T. Multiple listeners can be added for the same type.- Specified by:
registerListener
in interfaceObservable<T extends Notification>
- Parameters:
listener
- This is the listener which will be invoked incase of an Notification.
-
-