Java Reference
In-Depth Information
DProcess
ServerInterface
Client
Server
startRunner()
stopRunner()
DActivity
RunnerInterface
Animator
Runner
run()
setSpeed()
getPosition()
Figure 19.6 The test case's class diagram
Every client control module executes a single activity (instance of class
Animator in Figure 19.6) that animates one runner. This is not a limitation
of the framework. In fact, it is possible to have a single client control module
that executes several activities simultaneously. The server is a control
module that executes one activity (instance of class Runner in Figure 19.6)
for each remote user who wants to go jogging in the park.
The communication between client activities and server activities is
deferred synchronous. When a new instance of class Animator is created it
gets an RMI reference to a new instance of class Runner . The Runner object is
initialized with the path and speed selected by the user. Repeatedly it moves
the runner's position forward along its path. When the next lay-by is occu-
pied it waits until it is empty. The Animator object queries the Runner object
at fixed intervals of time in order to get the runner's current position and
visualize it on the graphical interface.
package jogging.server;
import java.rmi.*;
import mmi.*;
public interface ServerInterface
extends java.rmi.Remote {
public String startRunner( int path[])
throws java.rmi.RemoteException;
public void stopRunner(String activityURL)
throws java.rmi.RemoteException;
}
Search WWH ::




Custom Search