com.programix.sql
Class BottomlessConnectionPool
java.lang.Object
com.programix.sql.BottomlessConnectionPool
public class BottomlessConnectionPool
- extends Object
Sets up a simple, thread-safe, bottomless database connection pool.
When the pool is empty, checkOut() always attempts to create
an additional connection. The "max idle count" value is used to indicate
the maximum number of idle connections kept in the pool; as checkins occur
beyond this level, those connections are automatically closed.
The ValueMap passed can be created from a file that looks
something like this:
sql.connection.pool.driver=org.hsqldb.jdbcDriver
sql.connection.pool.url=jdbc:hsqldb:hsql://localhost:3500
sql.connection.pool.username=appuser
sql.connection.pool.password=secret
sql.connection.pool.max.idle.count=5
Where the "max idle count" is optional.
- Author:
- Paul Hyde
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DRIVER_KEY
public static final String DRIVER_KEY
- See Also:
- Constant Field Values
URL_KEY
public static final String URL_KEY
- See Also:
- Constant Field Values
USERNAME_KEY
public static final String USERNAME_KEY
- See Also:
- Constant Field Values
PASSWORD_KEY
public static final String PASSWORD_KEY
- See Also:
- Constant Field Values
MAX_IDLE_COUNT_KEY
public static final String MAX_IDLE_COUNT_KEY
- See Also:
- Constant Field Values
DEFAULT_MAX_IDLE_COUNT
public static final int DEFAULT_MAX_IDLE_COUNT
- See Also:
- Constant Field Values
BottomlessConnectionPool
public BottomlessConnectionPool(ValueMap config)
throws SQLException
- Throws:
SQLException
BottomlessConnectionPool
public BottomlessConnectionPool(Map<?,?> config)
throws SQLException
- Converts the
Map to a ValueMap and calls the
main constructor. Equivalent to:
this(ValueMap.ValueMap.createFrom(Map)createFrom(config));
- Throws:
SQLException
checkOut
public Connection checkOut()
throws SQLException
- Throws:
SQLException
checkIn
public void checkIn(Connection con)
- Returns the specified connection to the pool. If
con is
null, the check-in request is silently ignored.
close
public void close()
Copyright © 2001-2009
Programix Incorporated.
All rights reserved.
ProgramixGenericLib is free
and is
OSI Certified
Open Source Software under the BSD
license.