Java Reference
In-Depth Information
FIGURE 12-51
The following steps enter the code to synchronize threaded code on an
object — in this case, a data access object.
To Synchronize Multithreaded Code on an Object
1. Enter lines 469 through 505 as shown in Figure 12-39 on page 824.
TextPad displays the code to add a stock (Figure 12-52). If the user
already holds the stock, he or she is returned to the main Web page. If the
stock already exists in the database, a method is called to add it to the
user's stock holdings in the database, and a new list of stock holdings is
added as the stock's attribute. If the stock's attribute previously existed, it is
replaced. If the stock is not in the database, the request is forwarded to a
Web page to obtain a description for the new stock. Access to the database
is synchronized.
 
Search WWH ::




Custom Search