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

    • Listeners

      public Listeners()
      Default constructor.
  • Method Details

    • 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
    • getListenerCount

      public int getListenerCount()
      Returns the number of listeners.
      Returns:
      the number of 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 array of event listeners. It is illegal to modify the return value from this method.
      Returns:
      the array of event listeners
    • getListenerClassNames

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

      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

      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

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

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

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