textbender.g.util
Class CollectionRelayerLL<E>

java.lang.Object
  extended by CollectionRelayer<E>
      extended by CollectionRelayerLL<E>
All Implemented Interfaces:
EventListener, CollectionListener<E>

@ThreadSafe
public final class CollectionRelayerLL<E>
extends CollectionRelayer<E>

Relayer of collection events, with a collection of listeners that is guarded by a lock. Thread-safe if the listeners are thread-safe.


Nested Class Summary
 
Nested classes/interfaces inherited from interface CollectionListener
CollectionListener.Registry<E>
 
Constructor Summary
CollectionRelayerLL(Collection<CollectionListener<E>> listeners, Object listenersLock)
          Creates a CollectionRelayerLL.
 
Method Summary
protected  Collection<CollectionListener<E>> listenersCopy()
          Returns a copy of the listener collection.
 
Methods inherited from class CollectionRelayer
elementAdded, elementRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionRelayerLL

public CollectionRelayerLL(Collection<CollectionListener<E>> listeners,
                           Object listenersLock)
Creates a CollectionRelayerLL.

Parameters:
listeners - to whom events are relayed
listenersLock - held when making a copy of the collection of listeners, prior to relaying each event
Method Detail

listenersCopy

protected Collection<CollectionListener<E>> listenersCopy()
Description copied from class: CollectionRelayer
Returns a copy of the listener collection. A copy is used to guard against collection modification during relay, e.g. by the listeners themselves, which would cause relay iteration to fail.

Overrides:
listenersCopy in class CollectionRelayer<E>