org.mobicents.media.server.spi.listener
Class Listeners<L extends Listener>

java.lang.Object
  extended by org.mobicents.media.server.spi.listener.Listeners<L>

public class Listeners<L extends Listener>
extends Object

Implements collection of listener. Allows concurrently modify list.

Author:
kulikov

Constructor Summary
Listeners()
          Creates list of listeners with default size of 10.
Listeners(int size)
          Creates list of listeners with specified size.
 
Method Summary
 void add(L listener)
          Adds listener to the collection.
 void clear()
          Removes all listeners.
 boolean dispatch(Event event)
          Dispatched event to all registered listeners.
 void remove(Listener listener)
          Removes listener from the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Listeners

public Listeners()
Creates list of listeners with default size of 10.


Listeners

public Listeners(int size)
Creates list of listeners with specified size.

Parameters:
size - the size of list reserved for list.
Method Detail

add

public void add(L listener)
         throws TooManyListenersException
Adds listener to the collection.

Parameters:
listener - the listener to be added
Throws:
TooManyListenersException

remove

public void remove(Listener listener)
Removes listener from the collection.

Parameters:
listener - the listener to be removed.

clear

public void clear()
Removes all listeners.


dispatch

public boolean dispatch(Event event)
Dispatched event to all registered listeners.

Parameters:
event - the event to be dispatched
Returns:
true if event was delivered at least to one listener


Copyright © 2011. All Rights Reserved.