net.spy.db
Class ObjectPoolConnectionSource
java.lang.Object
net.spy.SpyObject
net.spy.db.ObjectPoolConnectionSource
- All Implemented Interfaces:
- ConnectionSource
- public class ObjectPoolConnectionSource
- extends SpyObject
- implements ConnectionSource
Connection source to retrieve connections from an ObjectPool.
The configuration passed into getConnection() requires the following
parameters:
- dbDriverName - Driver to load (i.e. org.postgresql.Driver)
- dbSource - dbUser
- dbUser - Database username
- dbPass - Database password
The following parameters are optional:
- dbPoolName - default: db
- dbMinConns - minimum number of connections - default 1
- dbStartConns - minimum number of connections - default 1
- dbYellowLine - the pool's ``yellow line'' percentage
- default 75
- dbMaxConns - maximum number of connections - default 5
- dbMaxLifeTime - maximum connection lifetime in milliseconds -
default 6 hours
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ObjectPoolConnectionSource
public ObjectPoolConnectionSource()
- Get an instance of SpyPoolConnectionSource.
getConnection
public Connection getConnection(SpyConfig conf)
throws SQLException
- Description copied from interface:
ConnectionSource
- Get a new connection.
- Specified by:
getConnection in interface ConnectionSource
- Parameters:
conf - a SpyConfig describing the connection that needs to be
fetched.
- Throws:
SQLException - if a connection could not be obtained- See Also:
ConnectionSource
returnConnection
public void returnConnection(Connection conn)
throws SQLException
- Description copied from interface:
ConnectionSource
- Return a connection. This method is used to inform whatever pooling
mechanism is in use that the connection is no longer wanted, or
needed, or even cared about here.
- Specified by:
returnConnection in interface ConnectionSource
- Throws:
SQLException- See Also:
ConnectionSource