Package com.tangosol.util
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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description Listeners()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.EventListener[]
getAsynchronousListeners()
Get the array of asynchronous event listeners.Filter[]
getFilters()
Return the array of filters associated with this Listeners object.String
getListenerClassNames()
Return a comma separated list of the listener class names.int
getListenerCount()
Returns the number of listeners.EventListener[]
getSynchronousListeners()
Get the array of synchronous event listeners.boolean
isEmpty()
Check if there are no listeners.EventListener[]
listeners()
Get the array of event listeners.void
remove(EventListener listener)
Remove a listener.void
removeAll()
Remove all listeners.void
setFilters(Filter[] aFilter)
Set the array of filters associated with this Listeners object.String
toString()
Return a string representation of the Listeners object.-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
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
-
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
-
-