June 1997
Intermediate to advanced
318 pages
8h 17m
English
The design pattern for registering interest in a unicast event is almost identical to that of a multicast event. It looks like:
public void add<ListenerType>(<ListenerType> listener)
throws java.util.TooManyListenersException;
public void remove<ListenerType>(<ListenerType> listener);The only difference between the unicast pattern and the multicast
pattern is the use of the throws clause with the
exception java.util.TooManyListenersException.
This pattern indicates that the source object supports only one
listener for the specified listener type. Invoking the
add<ListenerType>() method on a unicast
source registers the specified listener only if no other listener is
currently registered; if a listener is already registered,
java.util.TooManyListenersException is thrown.
Read now
Unlock full access