Package org.firebirdsql.gds.ng.listeners
Class AbstractListenerDispatcher<TListener>
- java.lang.Object
- 
- org.firebirdsql.gds.ng.listeners.AbstractListenerDispatcher<TListener>
 
- 
- Type Parameters:
- TListener- Listener type
 - All Implemented Interfaces:
- java.lang.Iterable<TListener>
 - Direct Known Subclasses:
- AsynchronousChannelListenerDispatcher,- DatabaseListenerDispatcher,- ServiceListenerDispatcher,- StatementListenerDispatcher,- TransactionListenerDispatcher
 
 public abstract class AbstractListenerDispatcher<TListener> extends java.lang.Object implements java.lang.Iterable<TListener>Dispatcher to maintain a list of listeners of typeTListener- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Constructor SummaryConstructors Constructor Description AbstractListenerDispatcher()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddListener(TListener listener)Adds the supplied listener to this dispatcher as a strongly referenced listener.voidaddWeakListener(TListener listener)Adds the supplied listener to this dispatcher as a weakly referenced listener.booleanisShutdown()java.util.Iterator<TListener>iterator()protected abstract voidlogError(java.lang.String message, java.lang.Throwable throwable)protected voidnotify(java.util.function.Consumer<TListener> notificationHandler, java.lang.String notificationLogName)voidremoveAllListeners()Removes all listeners from this dispatcher.voidremoveListener(TListener listener)Removes the supplied listener from this dispatcher (both weak and strong).voidshutdown()Shuts down this dispatcher and removes all listeners.
 
- 
- 
- 
Method Detail- 
addListenerpublic final void addListener(TListener listener) Adds the supplied listener to this dispatcher as a strongly referenced listener.A call to this method has no effect after shutdown()has been called.- Parameters:
- listener- Listener object
 
 - 
addWeakListenerpublic final void addWeakListener(TListener listener) Adds the supplied listener to this dispatcher as a weakly referenced listener.A call to this method has no effect after shutdown()has been called.Attempts to add a listener that is already strongly referenced will be ignored. - Parameters:
- listener- Listener object
 
 - 
removeListenerpublic final void removeListener(TListener listener) Removes the supplied listener from this dispatcher (both weak and strong).- Parameters:
- listener- Listener object
 
 - 
notifyprotected final void notify(java.util.function.Consumer<TListener> notificationHandler, java.lang.String notificationLogName) 
 - 
logErrorprotected abstract void logError(java.lang.String message, java.lang.Throwable throwable)
 - 
removeAllListenerspublic final void removeAllListeners() Removes all listeners from this dispatcher.
 - 
shutdownpublic final void shutdown() Shuts down this dispatcher and removes all listeners.After shutdown calls to addListener(Object)are ignored.
 - 
isShutdownpublic final boolean isShutdown() - Returns:
- truewhen this dispatcher has been shut down.
 
 
- 
 
-