org.jivesoftware.database
Class ConnectionPool
java.lang.Object
org.jivesoftware.database.ConnectionPool
- All Implemented Interfaces:
- Runnable
public class ConnectionPool
- extends Object
- implements Runnable
Database connection pool.
- Author:
- Jive Software
ConnectionPool
public ConnectionPool(String driver,
String serverURL,
String username,
String password,
int minCon,
int maxCon,
double conTimeout,
boolean mysqlUseUnicode)
throws IOException
- Throws:
IOException
getConnection
public Connection getConnection()
throws SQLException
- Throws:
SQLException
freeConnection
public void freeConnection()
destroy
public void destroy()
throws SQLException
- Throws:
SQLException
getSize
public int getSize()
run
public void run()
- Housekeeping thread. This thread runs every 30 seconds and checks connections for the
following conditions:
- Connection has been open too long - it'll be closed and another connection created.
- Connection hasn't been used for 30 seconds and the number of open connections is
greater than the minimum number of connections. The connection will be closed. This
is done so that the pool can shrink back to the minimum number of connections if the
pool isn't being used extensively.
- Unable to create a statement with the connection - it'll be reset.
- Specified by:
run
in interface Runnable
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2003-2007 Jive Software.