|
|||||||||||
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(Configuration configuration)
|
protected void |
debug(String message)
|
void |
dispose()
The dispose operation is called at the end of a components lifecycle. |
Connection |
getConnection()
Implements the ConnDefinition behavior when a connection is needed. |
protected void |
info(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(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 Connection getConnection() throws SQLException
getConnection
in interface org.apache.avalon.excalibur.datasource.DataSourceComponent
SQLException
- Document throws!public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
Configurable.configure(Configuration)
public void dispose()
dispose
in interface Disposable
Exception
- if an error is encountered during shutdownpublic void killAllConnections()
public void killConnection(PoolConnEntry entry)
entry
- the connection that had problemspublic void releaseConnection(PoolConnEntry entry)
entry
- public void run()
run
in interface Runnable
protected void debug(String message)
protected void info(String message)
protected void warn(String message)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |