org.gudy.azureus2.core3.util
Class ListenerManager<T>

java.lang.Object
  extended by org.gudy.azureus2.core3.util.ListenerManager<T>

public class ListenerManager<T>
extends Object


Constructor Summary
protected ListenerManager(String _name, ListenerManagerDispatcher<T> _target, boolean _async)
           
 
Method Summary
 void addListener(T listener)
           
 void clear()
           
static
<T> ListenerManager<T>
createAsyncManager(String name, ListenerManagerDispatcher<T> target)
           
static
<T> ListenerManager<T>
createManager(String name, ListenerManagerDispatcher<T> target)
           
 void dispatch(int type, Object value)
           
 void dispatch(int type, Object value, boolean blocking)
           
 void dispatch(T listener, int type, Object value)
           
 void dispatch(T listener, int type, Object value, boolean blocking)
           
protected  void dispatchInternal(List<T> listeners_ref, int type, Object value)
           
protected  void dispatchInternal(T listener, int type, Object value)
           
 void dispatchLoop()
           
 void dispatchWithException(int type, Object value)
           
static
<T> void
dispatchWithTimeout(List<T> _listeners, ListenerManagerDispatcher<T> _dispatcher, long _timeout)
           
protected  void doDispatch(T listener, int type, Object value)
           
protected  void doDispatchWithException(T listener, int type, Object value)
           
protected  String getListenerName(T listener)
           
 List<T> getListenersCopy()
           
 boolean hasListener(T listener)
           
 void removeListener(Object listener)
           
 long size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerManager

protected ListenerManager(String _name,
                          ListenerManagerDispatcher<T> _target,
                          boolean _async)
Method Detail

createManager

public static <T> ListenerManager<T> createManager(String name,
                                                   ListenerManagerDispatcher<T> target)

createAsyncManager

public static <T> ListenerManager<T> createAsyncManager(String name,
                                                        ListenerManagerDispatcher<T> target)

addListener

public void addListener(T listener)

removeListener

public void removeListener(Object listener)

hasListener

public boolean hasListener(T listener)

clear

public void clear()

getListenersCopy

public List<T> getListenersCopy()

dispatch

public void dispatch(int type,
                     Object value)

dispatch

public void dispatch(int type,
                     Object value,
                     boolean blocking)

dispatchWithException

public void dispatchWithException(int type,
                                  Object value)
                           throws Throwable
Throws:
Throwable

dispatch

public void dispatch(T listener,
                     int type,
                     Object value)

dispatch

public void dispatch(T listener,
                     int type,
                     Object value,
                     boolean blocking)

getListenerName

protected String getListenerName(T listener)

doDispatch

protected void doDispatch(T listener,
                          int type,
                          Object value)

doDispatchWithException

protected void doDispatchWithException(T listener,
                                       int type,
                                       Object value)
                                throws Throwable
Throws:
Throwable

dispatchInternal

protected void dispatchInternal(List<T> listeners_ref,
                                int type,
                                Object value)
                         throws Throwable
Throws:
Throwable

dispatchInternal

protected void dispatchInternal(T listener,
                                int type,
                                Object value)
                         throws Throwable
Throws:
Throwable

dispatchLoop

public void dispatchLoop()

dispatchWithTimeout

public static <T> void dispatchWithTimeout(List<T> _listeners,
                                           ListenerManagerDispatcher<T> _dispatcher,
                                           long _timeout)

size

public long size()