Package com.tangosol.util
Class Listeners
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.Listeners
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(EventListener listener) Add a listener.void
Add all listeners from another Listeners object.boolean
contains
(EventListener listener) Check if a listener is in the list of listeners.Get the array of asynchronous event listeners.Filter[]
Return the array of filters associated with this Listeners object.Return a comma separated list of the listener class names.int
Returns the number of listeners.Get the array of synchronous event listeners.boolean
isEmpty()
Check if there are no listeners.Get the array of event listeners.void
remove
(EventListener listener) Remove a listener.void
Remove all listeners.void
setFilters
(Filter[] aFilter) Set the array of filters associated with this Listeners object.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
-
Constructor Details
-
Listeners
public Listeners()Default constructor.
-
-
Method Details
-
add
Add a listener.- Parameters:
listener
- the EventListener to add
-
remove
Remove a listener.- Parameters:
listener
- the EventListener to remove
-
addAll
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
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
Get the array of event listeners. It is illegal to modify the return value from this method.- Returns:
- the array of event listeners
-
getListenerClassNames
Return a comma separated list of the listener class names.- Returns:
- a comma separated list of the listener class names
-
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
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
Set the array of filters associated with this Listeners object.- Parameters:
aFilter
- the array of associated filters
-
getFilters
Return the array of filters associated with this Listeners object.- Returns:
- the array of filters associated with this Listeners object
-
toString
Return a string representation of the Listeners object.
-