Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.listeners
Class AbstractListenerDispatcher<L>
java.lang.Object
org.firebirdsql.gds.ng.listeners.AbstractListenerDispatcher<L>
- Type Parameters:
L
- Listener type
- All Implemented Interfaces:
Iterable<L>
- Direct Known Subclasses:
AsynchronousChannelListenerDispatcher
,DatabaseListenerDispatcher
,ServiceListenerDispatcher
,StatementListenerDispatcher
,TransactionListenerDispatcher
Dispatcher to maintain a list of listeners of type
L
.- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addListener
(L listener) Adds the supplied listener to this dispatcher as a strongly referenced listener.final void
addWeakListener
(L listener) Adds the supplied listener to this dispatcher as a weakly referenced listener.final boolean
iterator()
protected abstract void
protected final void
final void
Removes all listeners from this dispatcher.final void
removeListener
(L listener) Removes the supplied listener from this dispatcher (both weak and strong).final void
shutdown()
Shuts down this dispatcher and removes all listeners.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractListenerDispatcher
public AbstractListenerDispatcher()
-
-
Method Details
-
addListener
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
-
addWeakListener
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
-
removeListener
Removes the supplied listener from this dispatcher (both weak and strong).- Parameters:
listener
- Listener object
-
notify
-
logError
-
removeAllListeners
public final void removeAllListeners()Removes all listeners from this dispatcher. -
shutdown
public final void shutdown()Shuts down this dispatcher and removes all listeners.After shutdown calls to
addListener(Object)
are ignored. -
isShutdown
public final boolean isShutdown()- Returns:
true
when this dispatcher has been shut down.
-
iterator
-