18.8. Connection Pooling: A Case Study
OK, so we have a ConnectionPool class: what good does it do us? Let's find out. Listing 18.20 presents a simple servlet that allocates a ConnectionPool in its init method, then, for each request, performs a simple database lookup and places the results in an HTML table. Listing 18.21 and Figure 18-6 show an HTML document that places a copy of this servlet in each of 25 frame cells. Since the servlet stipulates that it not be cached by the browser, this document results in 25 near simultaneous HTTP requests and thus 25 near simultaneous database lookups using connection pooling. This request pattern is similar to what would occur on high-traffic sites even when only a single servlet is used for each page. ...
Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.