You can configure the ConnectionPoolDataSource interface by using the set of properties that it provides.
Property | Description |
---|---|
initialPoolSize | When the pool is first instantiated, this property determines how many connections are placed into the pool. If this value is specified outside the range of minPoolSize and maxPoolSize, either minPoolSize or maxPoolSize is used as the number of initial connections to create. |
maxPoolSize | As the pool is used, more connections may be requested than the pool
has in it. This property specifies the maximum number of connections allowed
to be created in the pool. Applications do not "block" and wait for a connection to be returned to the pool when the pool is at its maximum size and all connections are in use. Instead, the JDBC driver constructs a new connection based on the DataSource properties and returns the connection. If a maxPoolSize of 0 is specified, the pool is allowed to grow unbounded as long as the system has resources available to hand out. |
minPoolSize | Spikes in using the pool can cause it to increase the number of connections
in it. If the activity level diminishes to the point where some Connections
are never pulled out of the pool, the resources are being taken up for no
particular reason. In such cases, the JDBC driver has the ability to release some of the connections that it has accumulated. This property allows you to tell the JDBC to release connections, ensuring that it always has a certain number of connections available to use. If a minPoolSize of 0 is specified, it is possible for the pool to free all of its connections and for the application to actually pay for the connection time for each connection request. |
maxIdleTime | Connections keep track of how long they have been sitting around without
being used. This property specifies how long an application allows connections
to be unused before they are released (that is, there are more connections
than are needed). This property is a time in seconds and does not specify when the actual close occurs. It specifies when enough time has passed that the connection should be released. |
propertyCycle | This property represents the number of seconds that are allowed to pass between the enforcement of these rules. |
When maxIdleTime and propertyCycle are not 0, a management thread is used to watch over the pool. The thread wakes up every propertyCycle second and checks all the connections in the pool to see which ones have been there without being used for more than maxIdleTime seconds. Connections fitting this criterion are removed from the pool until the minPoolSize is reached.