CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Class Listeners

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.Listeners
All Implemented Interfaces:
Serializable

public class Listeners
extends Base
implements Serializable

Provide a simple, efficient, and thread-safe implementation of a list of event listeners. The implementation is optimized based on the assumption that listeners are added and removed relatively rarely, and that the list of listeners is requested relatively often. Thread safety is implemented by synchronizing on all methods that modify any data member of the class. Read-only methods are not synchronized.

Version:
1.00, 11/16/97
Author:
Cameron Purdy

Constructor Summary
Listeners()
          Default constructor.
 
Method Summary
 void add(EventListener listener)
          Add a listener.
 void addAll(Listeners listeners)
          Add all listeners from another Listeners object.
 boolean contains(EventListener listener)
          Check if a listener is in the list of listeners.
 boolean isEmpty()
          Check if there are no listeners.
 EventListener[] listeners()
          Get the list of listeners.
 void remove(EventListener listener)
          Remove a listener.
 void removeAll()
          Remove all listeners.
 String toString()
          Return a string representation of the Listeners object.
 

Constructor Detail

Listeners

public Listeners()
Default constructor.

Method Detail

add

public void add(EventListener listener)
Add a listener.

Parameters:
listener - the EventListener to add

remove

public void remove(EventListener listener)
Remove a listener.

Parameters:
listener - the EventListener to remove

addAll

public void addAll(Listeners listeners)
Add all listeners from another Listeners object.

Parameters:
listeners - the Listeners to add

removeAll

public void removeAll()
Remove all listeners.


isEmpty

public boolean isEmpty()
Check if there are no listeners.

Returns:
true if there are no listeners

contains

public boolean contains(EventListener listener)
Check if a listener is in the list of listeners.

Parameters:
listener - the EventListener to search for
Returns:
true if the listener is in the list of listeners

listeners

public EventListener[] listeners()
Get the list of listeners. It is illegal to modify the return value from this method.

Returns:
a the list of listeners

toString

public String toString()
Return a string representation of the Listeners object.

Returns:
a string representation of the Listeners object

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation