|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLogEnabled | +--org.apache.james.util.mordred.JdbcDataSource
This is a reliable DataSource implementation, based on the pooling logic written for Town and the configuration found in Avalon's excalibur code.
This uses the normal java.sql.Connection
object and
java.sql.DriverManager
. The Configuration is like this:
<jdbc> <pool-controller min="5" max="10" connection-class="my.overrided.ConnectionClass"> <keep-alive>select 1</keep-alive> </pool-controller> <driver>com.database.jdbc.JdbcDriver</driver> <dburl>jdbc:driver://host/mydb</dburl> <user>username</user> <password>password</password> </jdbc>
Field Summary | |
static long |
ACTIVE_CONN_TIME_LIMIT
|
static long |
CONN_IDLE_LIMIT
|
Fields inherited from interface org.apache.avalon.excalibur.datasource.DataSourceComponent |
ROLE |
Constructor Summary | |
JdbcDataSource()
|
Method Summary | |
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
Configure and set up DB connection. |
protected void |
debug(java.lang.String message)
|
void |
dispose()
Need to clean up all connections |
java.sql.Connection |
getConnection()
Implements the ConnDefinition behavior when a connection is needed. |
protected void |
info(java.lang.String message)
|
void |
killAllConnections()
Deprecated. This was left over code from Town... but not exposed in Avalon. |
void |
killConnection(PoolConnEntry entry)
Deprecated. - No longer used in the new approach. |
void |
releaseConnection(PoolConnEntry entry)
Implements the ConnDefinition behavior when a connection is no longer needed. |
void |
run()
Background thread that checks if there are fewer connections open than minConn specifies, and checks whether connections have been checked out for too long, killing them. |
protected void |
warn(java.lang.String message)
|
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long ACTIVE_CONN_TIME_LIMIT
public static final long CONN_IDLE_LIMIT
Constructor Detail |
public JdbcDataSource()
Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
org.apache.avalon.framework.configuration.ConfigurationException
public void releaseConnection(PoolConnEntry entry)
public void killConnection(PoolConnEntry entry)
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface org.apache.avalon.excalibur.datasource.DataSourceComponent
java.sql.SQLException
public void run()
run
in interface java.lang.Runnable
public void killAllConnections()
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
protected void warn(java.lang.String message)
protected void info(java.lang.String message)
protected void debug(java.lang.String message)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |