LimeWire Consolidated API

org.limewire.listener
Class AsynchronousMulticaster<E>

java.lang.Object
  extended by org.limewire.listener.AsynchronousMulticaster<E>
All Implemented Interfaces:
EventBroadcaster<E>, EventListener<E>, EventMulticaster<E>, ListenerSupport<E>

public class AsynchronousMulticaster<E>
extends Object
implements EventMulticaster<E>

An EventMulticaster that broadcasts all its events within an executor. This is useful if you want to asynchronously notify listeners about events (especially handy if the events are generated while holding a lock). If the executor is single-threaded, this can guarantee that all events are dispatched in the same order they were broadcast.


Constructor Summary
AsynchronousMulticaster(Executor executor)
           
AsynchronousMulticaster(Executor executor, Class loggerKey)
           
AsynchronousMulticaster(Executor executor, Log log)
           
 
Method Summary
 void addListener(EventListener<E> listener)
          Adds the listener.
 void broadcast(E event)
          Broadcasts this event to anyone listening.
 void handleEvent(E event)
          Notification that an event has occurred and should be handled.
 boolean removeListener(EventListener<E> listener)
          Returns true if the listener was removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousMulticaster

public AsynchronousMulticaster(Executor executor)

AsynchronousMulticaster

public AsynchronousMulticaster(Executor executor,
                               Class loggerKey)

AsynchronousMulticaster

public AsynchronousMulticaster(Executor executor,
                               Log log)
Method Detail

addListener

public void addListener(EventListener<E> listener)
Description copied from interface: ListenerSupport
Adds the listener.

Specified by:
addListener in interface ListenerSupport<E>

removeListener

public boolean removeListener(EventListener<E> listener)
Description copied from interface: ListenerSupport
Returns true if the listener was removed.

Specified by:
removeListener in interface ListenerSupport<E>

handleEvent

public void handleEvent(E event)
Description copied from interface: EventListener
Notification that an event has occurred and should be handled.

Specified by:
handleEvent in interface EventListener<E>

broadcast

public void broadcast(E event)
Description copied from interface: EventBroadcaster
Broadcasts this event to anyone listening.

Specified by:
broadcast in interface EventBroadcaster<E>

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.