JavaBean Events   «Prev  Next»
Lesson 10Unicast and multicast event delivery
Objective Learn about unicast and multicast event delivery.

Unicast | Multicast Event Delivery

When covering event design patterns in the previous module, you learned a little about multicast[1] and unicast event sources[2]. Multicast event delivery involves an event being broadcast to multiple event listeners simultaneously, while unicast event delivery involves an event being delivered only to a single event listener. Multiple event listeners can be registered with a multicast event source using event registration methods, while only one event listener can be registered with a unicast event source. If you attempt to register more than one event listener with a unicast event source, the event registration method will disallow the registration and throw an exception.

multicast event delivery
Multicast event delivery

Multicast event delivery

unicast event delivery
unicast event delivery

Unicast event delivery

It is important to understand that unicast event delivery is a more limited form of event delivery and should be avoided whenever possible. In other words, when developing your own Beans you should try to make them support multicast event delivery. All of the standard Java AWT components support multicast event delivery.

Event Adapters - Exercise

Click the Exercise link to sort out the event delivery process.
Event Adapters - Exercise

In the next lesson, you use the BeanBox to wire Beans together with events.
[1]Multicast event source:an event source capable of generating events for retrieval by any number of listeners.
[2]Unicast event source: an event source capable of generating events for retrieval by only one listener.