Java Reference
In-Depth Information
Figure 17.3
A more developed client class diagram.
name in the Server object. The same change, as well as the addition of the
start() method to Server , must be propagated to ServerInterface and
the server-side UML diagrams as well. We won't take up space showing the
modified diagrams here, but we must remember to make those changes when
implementation is begun.
There are a few more loose ends to be cleaned up during implementation.
One important example is protecting against thread collisions between the poller
thread and the thread that is displaying the data in PlotPane and TextPane .
A good approach is for the poller to duplicate the received data during a syn-
chronized block. Then the display objects can lock on the same synchroniza-
tion object while updating their displays with that data. Accordingly, we show
a private synchObj attribute in DataManager . Both PollerThread and
the output panes could obtain a reference to that synchronization object and
use it to protect code that accesses the data copy. (Note that the synchObj is
declared to be private to DataManager in order to preserve good encapsula-
tion, but that does not prevent DataManager from making it available in a public
getSynchObj() method.) If the poller obtains another data set from the server
while the output panes still have the lock, the poller must wait until the lock is
released before making a copy of the new data set. Since we want the poller to poll
Search WWH ::




Custom Search