Jive Forums API (5.5.8) Developer Javadocs

com.jivesoftware.base.database
Class ConnectionPool

java.lang.Object
  extended by com.jivesoftware.base.database.ConnectionPool
All Implemented Interfaces:
java.lang.Runnable

public class ConnectionPool
extends java.lang.Object
implements java.lang.Runnable

Database connection pool implementation.

Two Jive properties control database-specific features:


Constructor Summary
ConnectionPool(java.lang.String driver, java.lang.String serverURL, java.lang.String username, java.lang.String password, int minCon, int maxCon, double conTimeout)
           
 
Method Summary
 void destroy()
           
 void freeConnection()
          Notifies threads waiting on monitor for open connections that a connection is now available.
 int getActiveConnectionCount()
          Returns the number of open connections that are actively in use.
 java.sql.Connection getConnection()
           
 int getSize()
          Returns the current number of connections in the pool.
 void run()
          Housekeeping thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionPool

public ConnectionPool(java.lang.String driver,
                      java.lang.String serverURL,
                      java.lang.String username,
                      java.lang.String password,
                      int minCon,
                      int maxCon,
                      double conTimeout)
               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

freeConnection

public void freeConnection()
Notifies threads waiting on monitor for open connections that a connection is now available.


destroy

public void destroy()
             throws java.sql.SQLException
Throws:
java.sql.SQLException

getActiveConnectionCount

public int getActiveConnectionCount()
Returns the number of open connections that are actively in use.

Returns:
the number of open connections that are actively in use.

getSize

public int getSize()
Returns the current number of connections in the pool. The value will be somewhere beteen the min and max connection values.

Returns:
the number of connections in the pool.

run

public void run()
Housekeeping thread. This thread runs every 30 seconds and checks connections for the following conditions:

Specified by:
run in interface java.lang.Runnable

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.