Class Listeners

java.lang.Object
com.tangosol.util.Base
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
See Also:
  • Constructor Details Link icon

    • Listeners Link icon

      public Listeners()
      Default constructor.
  • Method Details Link icon

    • add Link icon

      public void add(EventListener listener)
      Add a listener.
      Parameters:
      listener - the EventListener to add
    • remove Link icon

      public void remove(EventListener listener)
      Remove a listener.
      Parameters:
      listener - the EventListener to remove
    • addAll Link icon

      public void addAll(Listeners listeners)
      Add all listeners from another Listeners object.
      Parameters:
      listeners - the Listeners to add
    • removeAll Link icon

      public void removeAll()
      Remove all listeners.
    • isEmpty Link icon

      public boolean isEmpty()
      Check if there are no listeners.
      Returns:
      true if there are no listeners
    • getListenerCount Link icon

      public int getListenerCount()
      Returns the number of listeners.
      Returns:
      the number of listeners
    • contains Link icon

      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 Link icon

      public EventListener[] listeners()
      Get the array of event listeners. It is illegal to modify the return value from this method.
      Returns:
      the array of event listeners
    • getListenerClassNames Link icon

      public String getListenerClassNames()
      Return a comma separated list of the listener class names.
      Returns:
      a comma separated list of the listener class names
    • getAsynchronousListeners Link icon

      public EventListener[] getAsynchronousListeners()
      Get the array of asynchronous event listeners. It is illegal to modify the return value from this method.
      Returns:
      the array of asynchronous event listeners
    • getSynchronousListeners Link icon

      public EventListener[] getSynchronousListeners()
      Get the array of synchronous event listeners. It is illegal to modify the return value from this method.
      Returns:
      the array of synchronous event listeners
    • setFilters Link icon

      public void setFilters(Filter[] aFilter)
      Set the array of filters associated with this Listeners object.
      Parameters:
      aFilter - the array of associated filters
    • getFilters Link icon

      public Filter[] getFilters()
      Return the array of filters associated with this Listeners object.
      Returns:
      the array of filters associated with this Listeners object
    • toString Link icon

      public String toString()
      Return a string representation of the Listeners object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the Listeners object