Browse Prior Art Database

A timer-assisted connection pool manager

IP.com Disclosure Number: IPCOM000021752D
Original Publication Date: 2004-Feb-05
Included in the Prior Art Database: 2004-Feb-05
Document File: 2 page(s) / 24K

Publishing Venue

IBM

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 64% of the total text.

Page 1 of 2

A timer-assisted connection pool manager

A program is disclosed that shows what a Java* Database
Connectivity (JDBC) connection pool manager may do to shut down
established but idled connections. The program demonstrates how
to schedule a background task for shutting down those pooled
connections that have not been used for some period of time.

A connection pool manager manages a pool of JDBC connections and
provides an interface for a client to request or return a
connection. (See Fig. 1)

+------------+

| |

| +---------------+

| Connection | getConnection |

| Pool +---------------+

| Manager |

| +---------------+

| +------+ | putConnection |

| | pool | +---------------+

| +------+ |

+------------+

Figure 1. A connection pool manager's interface

As the time goes on during the execution of an application, the
connection pool manager may see the number of connections in the
pool grow and some of them may be idled for a long period of
time. The connection pool manager must close these idled
connections for optimal utilization of the connection resources.
One way to accomplish this is to implement a new interface and
schedule a task to invoke the interface periodically, as shown in
Fig. 2.

+------------+

| |

| +---------------+

| Connection | getConnection |

| Pool +---------------+

| Manager |

| +---------------+

| +------+ | putConnection |

| | pool | +---------------+ DelayedCloseTask

| +------+ | +----------+

| +-----------------------+ | |

| | closeIdledConnections |<----+ run |

| +-----------------------+ | |

| | +----------+

+------------+

Figure 2. A connection pool manager with interface

for delayed close of idled connections

1

Page 2 of 2

The connection pool manager and the scheduled task cooperate to
close and remove idled connections as follows:

During the setup time (instantiation), the connection pool
manager creates a DelayedCloseTask which is a Java TimerTask and
use the Java Timer class to schedule the frequency of its
execution.

To create an instance of the DelayedCloseTask, it requires a
reference of the connection pool manager. This i...