Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.util
Class Listeners

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.Listeners

All Implemented Interfaces:
java.io.Serializable

public class Listeners
extends Base
implements java.io.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(java.util.EventListener listener)
          Add a listener.
 void addAll(Listeners listeners)
          Add all listeners from another Listeners object.
 boolean contains(java.util.EventListener listener)
          Check if a listener is in the list of listeners.
 java.util.EventListener[] getAsynchronousListeners()
          Get the array of asynchronous event listeners.
 java.util.EventListener[] getSynchronousListeners()
          Get the array of synchronous event listeners.
 boolean isEmpty()
          Check if there are no listeners.
 java.util.EventListener[] listeners()
          Get the array of event listeners.
 void remove(java.util.EventListener listener)
          Remove a listener.
 void removeAll()
          Remove all listeners.
 java.lang.String toString()
          Return a string representation of the Listeners object.

 

Constructor Detail

Listeners

public Listeners()
Default constructor.

Method Detail

add

public void add(java.util.EventListener listener)
Add a listener.
Parameters:
listener - the EventListener to add

remove

public void remove(java.util.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(java.util.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 java.util.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

getAsynchronousListeners

public java.util.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 java.util.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

toString

public java.lang.String toString()
Return a string representation of the Listeners object.
Returns:
a string representation of the Listeners object

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.