Java Reference
In-Depth Information
19.5.2
Design
CORBA supports two distinct approaches called the “push model” and the
“pull model”. The push model gives the broadcaster the responsibility of
notifying the remote listeners when an event is raised. The pull model
gives the listener the responsibility of pulling events from the broadcasters
periodically.
We want the MMI framework to support the push model, since it is the
seamless evolution in a distributed setting of the Observer
-
Observable
model described in Sidebar 8.1 (page 181).
Decision point
How does the control module support asynchronous communication?
L
communication paradigm. This is achieved by implementing new classes
and interfaces that resemble those described in Sidebar 8.1. Figure 19.7
shows the new interfaces DObservable and Observer , which extend the java.
rmi.Remote interface, class DEvent , which implements the java.io.Serializable
interface in order to allow distributed clients and servers to exchange events
over the internet, and class DSubscription , which records the association
between a remote observer of an activity and an event that the activity may
notify.
Interface DObservable defines the addObserver() method which is imple-
mented in class DActivity . Remote clients register themselves as observers of
a DActivity object by passing their own URL address to addObserver() along
The MMI framework uses the Java RMI mechanism to implement the B
-
java.rmi.Remote
DObserver
DObservable
updateEvent()
addObserver()
DSubscription
String eventName
String observableURL
String observerURL
DObserver observer
DEvent
DActivity
String name
Obejct value
String ownerURL
addObserver()
notifyObservers()
updateEvent()
update()
Figure 19.7 The classes implementing the B-L communication paradigm
 
Search WWH ::




Custom Search