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