Java Reference
In-Depth Information
public void step() {
try {
pathFrame.setPosition(runner.getPosition());
thread.sleep(refresh);
} catch (Exception e) {e.printStackTrace(); }
}
// requests the remote server to terminate the "runner"
// service
public void quit() {
try {
((Client) process).server.stopRunner(runnerURL);
} catch (RemoteException re) { re.printStackTrace(); }
}
// requests the remote server to change the runner's speed
public void setSpeed(int percent) {
try {
runner.setSpeed(percent);
} catch (RemoteException re) {re.printStackTrace();}
}
}
19.5
Prototype 2: Asynchronous communication
The focus of this prototype is on the asynchronous communication between
remote control modules.
19.5.1
Analysis
In open distributed systems the communication between remote control
modules is often structured according to the broadcaster
listeners (B-L)
paradigm (see Section 8.8), which gives control modules the ability to
broadcast and listen to events. The broadcaster does not know the identity
of its listeners, which might change over time. Conversely, the clients that
want to be notified when an event is raised must know the identity of the
server that broadcasts that event.
In previous case studies we developed a few event-driven systems, such as
the manufacturing work cell (Chapter 9) and the car parking control system
(Chapter 11). In particular, Prototype 2 of Chapter 11 shows how to use
class Observable and interface Observer of package java.util (see Sidebar 8.1,
page 181) to build a standalone application that implements the B
-
-
L
paradigm.
Now our goal is to extend the MMI framework in order to support the B
L
paradigm in a distributed setting, i.e. to allow autonomous control modules
to exchange events through the internet.
-
 
Search WWH ::




Custom Search