Global Positioning System Reference
In-Depth Information
...
candidates.put( ID, newCandidate );
...
}
private Map<Object,ServerObject> candidates
= new HashMap<Object,ServerObject>();
The candidate collection maps the intrinsic ID to its SO and reduces to
server logic to the handling of ID keys to interact with a client. The syn-
chronization of the ROBox is vital to avoid two clones running into a conflict;
the rule is first come first serve. Although the utility class Collections pro-
vides methods to make collections synchronized, the architect decides to
synchronize the access on the ROBox wrapping candidate and actor's collec-
tions. (Actors are the ROs that have entered the scenario to become part
of it.)
After creating a server object, mapping it to the identity object, and
putting it into the candidate list, the identification process is completed and
the candidate can get ready to enter the scenario and become an actor (in
a few pages):
synchronized boolean putActor( Object ID ) { ... }
private Map<Object,ServerObject> actors
= new HashMap<Object,ServerObject>();
Note that putActor is using the ID while putCandidate is using the SO
as parameter. These semantics imply that an actor has to be an identi-
fied candidate to be able to enter the scenario. Depending on the server
application, the remote client might have to be recognized by another iden-
tification process.
With a simple integer identifier, the client programmer could apply a
hack: use one client to identify and enter with another client with the
same ID. Of course, the server should be able to expose technical hacks.
A \nice-to-have" is a dynamical spatial index for all actors. That way
any client connected to a scenario could restrict the number of actors by
the bounding box relevant to himself.
11.9
ROAdio Broadcasting
At this point the client server communication via RMI should be clear.
Server and client have a remote reference to each other and can retrieve
information as needed. The executor framework decouples the server re-
sponse to various clients.
The Bingo application (see page 144) suggests another type of commu-
nication:
 
Search WWH ::




Custom Search