Java Reference
In-Depth Information
Forces or tradeoffs
The state of a broadcaster object changes according to its
own dynamic behaviour. When a state transition occurs,
the broadcaster object raises an event. One or more
listener objects observe state changes in the broadcaster
object.
In order to enforce reusability, the broadcaster object does
not know which objects are observing its state changes.
Listener objects might change over time.
Solution
Event notification is centralized. Broadcaster objects post
their events at the centralized clock.
Listener objects subscribe to event notification. When a
broadcaster object posts an event, the centralized clock
notifies the subscribed listeners.
Force resolution
Broadcaster objects post events whenever a state
transition occurs using a method of the centralized clock.
Listener objects implement a common interface that
includes a notification method. When an event is posted,
the clock invokes the notification method of each listener.
The clock implements methods for event subscription and
unsubscription.
Design rationale
In Chapter 8 the broadcaster-listener model has been
presented in the context of Pattern Observer . Sidebar 8.1
Observer observable (page 181) describes the classes of
the java.util library that implement this communication
model.
9.8
Reference
Kouikogloui, V. S. and Phillis, Y. A. (2001) Hybrid Simulation Models of Production
Networks , Kluwer Academic
Plenum Publishers.
 
Search WWH ::




Custom Search