Summary


This chapter shows how to use an implementation of a common patternthe use of a pool. Pools typically serve one of two roleseither as a logical representation of a pool, or as a performance enhancement by way of a cache implementation. If a pool represents a logical pool, you should feel free to use the pattern immediatelyfor example, an application for reserving hotel rooms might use a pool to track the available rooms. If a pool represents a cache of some sort, it should be added to an application later rather than sooner to avoid premature optimization.

Pools are commonly used as a performance enhancement for managing connections to a database. The next chapter will look at a specific pool designed for managing database-specific resources.

Project Ideas

Build an application that uses the Pool package to wrap Net NNTP connections (as described in Chapter 4). Add a user interface to allow a user to browse the NNTP articles on one thread and then a configurable number of other threads to download articles in the background.

Build a test harness that tests the size and options available for different pools against the factories. Given this information and other data available to a running Java application (such as the current memory available), would it be possible to build a self-tuning pool?




    Apache Jakarta Commons(c) Reusable Java Components
    Real World Web Services
    ISBN: N/A
    EAN: 2147483647
    Year: 2006
    Pages: 137
    Authors: Will Iverson

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net