Java Reference
In-Depth Information
// This method can be invoked only by subclasses of
// DProcess, which implement specific methods for the
// termination of their activities.
protected void
stopActivity(String activityURL) {
Iterator iterator
#
activityList.iterator();
while
(iterator.hasNext()) {
DActivity activity
#
(DActivity) iterator.next();
if
(activity.getURL().equals(activityURL)) {
try
{
activity.stop();
activityList.remove(activity);
Naming.unbind(activity.name);
}
catch
(Exception e) { e.printStackTrace();}
return
;
}
}
}
}
19.4.4
Test
In order to test the functionalities of the framework classes, we implement a
simple client
server distributed application that exemplifies multi-client
interaction. Figure 19.5 shows a screenshot of the graphical interface and of
the command line. The server manages the representation of a jogging park
made up of lay-bys connected via tracks. A client application is a graphical
interface that allows the user to select a path, i.e. a sequence of lay-bys, and
that animates a runner on that path. Each lay-by can be occupied by only
one runner at a time. The server manages the concurrent access to shared
lay-bys.
The server and the client applications (instances of class
Server
and
Client
in Figure 19.6) are implemented as control modules that run on different
hosts and communicate through the internet.
-
Figure 19.5
A screen shot during the test case execution.
Copyright © 2005 Sun
Microsystems, Inc. All rights reserved. Reproduced by permission of Sun Microsystems, Inc.