Java Reference
In-Depth Information
Figure 16.6
Collaboration diagram illustrating the internal server architecture.
separate thread. The client's data request comes to the front-end server compo-
nent. If the compute engine has control of the CPU, then there is no way for the
front-end server to handle that request unless the front-end server is running on
a separate thread. (In a single-threaded world, the compute engine would have
to periodically give up the calculation and poll the front-end server to see if any
new data request had been made.) While we're considering multithreaded issues,
also notice that both the compute engine and the front-end server have access to
the data in the data storage component. Therefore there will be synchronization
issues to deal with to ensure the integrity of the data in the data storage component
since that data is stored and retrieved by separate threads.
With these concerns in mind, we can now create a collaboration diagram
showing the interactions among the various server-side components. We identify
the front-end server object merely as Server .Itisthe object with which the
client interacts. Though it contains other methods, recall that the only publicly
exposed methods that the client knows about are defined in ServerInterface ,
which Server must implement.
Let's call the object that embodies the compute engine Simulation since
the client/server application we are designing is best thought of as an interactive
simulation rather than a batch-mode client/server interaction. We call the data
storage component SimData , since it stores the results of the simulation. To
explicitly show the multithreaded nature of the architecture, we also introduce
a SimulationThread object. These objects are shown in the collaboration
diagram in Figure 16.6, which also introduces a bit more UML notation.
As this is more complicated than the previous diagrams, we'll walk through
the diagram by sequence number and point out the new features. In sequence
number 1, the Server instantiates a SimData object and retains a reference
to it called simData .(We have dispensed with the “{ new } notation here
to reduce clutter and because it provides no additional information. Instead,
Search WWH ::




Custom Search