You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/02/07 09:10:07 UTC
cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/datasource ResourceLimitingJdbcDataSource.java
leif 02/02/07 00:10:06
Modified: src/scratchpad/org/apache/avalon/excalibur/datasource
ResourceLimitingJdbcDataSource.java
Log:
Added more descriptive JavaDocs
Revision Changes Path
1.4 +48 -7 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcDataSource.java
Index: ResourceLimitingJdbcDataSource.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcDataSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ResourceLimitingJdbcDataSource.java 26 Jan 2002 16:58:26 -0000 1.3
+++ ResourceLimitingJdbcDataSource.java 7 Feb 2002 08:10:06 -0000 1.4
@@ -21,8 +21,9 @@
/**
* The ResourceLimiting implementation for DataSources in Avalon. This uses the
* normal <code>java.sql.Connection</code> object and
- * <code>java.sql.DriverManager</code>. The Configuration is like this:
- *
+ * <code>java.sql.DriverManager</code>.
+ * <p>
+ * Configuration Example:
* <pre>
* <jdbc>
* <pool-controller max="<i>10</i>" blocking="<i>true</i>"
@@ -36,9 +37,8 @@
* <password><i>password</i></password>
* </jdbc>
* </pre>
- *
- * With the following roles declaration:
- *
+ * <p>
+ * Roles Example:
* <pre>
* <role name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
* shorthand="datasources"
@@ -47,9 +47,50 @@
* class="org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource"/>
* </role>
* </pre>
+ * <p>
+ * Configuration Attributes:
+ * <ul>
+ * <li>The <code>max</code> attribute is used to set the maximum number of connections which
+ * will be opened. See the <code>blocking</code> attribute. (Defaults to "3")</li>
+ *
+ * <li>The <code>blocking</code> attributes is used to specify the behavior of the DataSource
+ * pool when an attempt is made to allocate more than <code>max</code> concurrent connections.
+ * If true, the request will block until a connection is released, otherwise, a
+ * NoAvailableConnectionException will be thrown. (Defaults to "true")</li>
+ *
+ * <li>The <code>timeout</code> attribute is used to specify the maximum amount of time in
+ * milliseconds that a request for a connection will be allowed to block before a
+ * NoAvailableConnectionException is thrown. A value of "0" specifies that the block will never
+ * timeout. (Defaults to "0")</li>
+ *
+ * <li>The <code>trim-interval</code> attribute is used to specify how long idle connections will
+ * be maintained in the pool before being closed. For a complete explanation on how this works,
+ * see {@link org.apache.avalon.excalibur.pool.ResourceLimitingPool#trim()}
+ * (Defaults to "60000", 1 minute)</li>
+ *
+ * <li>The <code>connection-class</code> attribute is used to override the Connection class returned
+ * by the DataSource from calls to getConnection(). Set this to
+ * "org.apache.avalon.excalibur.datasource.Jdbc3Connection" to gain access to JDBC3 features.
+ * (Defaults to "org.apache.avalon.excalibur.datasource.JdbcConnection")</li>
+ *
+ * <li>The <code>keep-alive</code> element is used to override the query used to monitor the health
+ * of connections. If a connection has not been used for 5 seconds then before returning the
+ * connection from a call to getConnection(), the connection is first used to ping the database
+ * to make sure that it is still alive. Setting the <code>disable</code> attribute to true will
+ * disable this feature. (Defaults to a query of "SELECT 1" and being enabled)</li>
+ *
+ * <li>The <code>driver</code> element is used to specify the driver to use when connecting to the
+ * database. The specified class must be in the classpath. (Required)</li>
+ *
+ * <li>The <code>dburl</code> element is the JDBC connection string which will be used to connect to
+ * the database. (Required)</li>
+ *
+ * <li>The <code>user</code> and <code>password</code> attributes are used to specify the user and
+ * password for connections to the database. (Required)</li>
+ * </ul>
*
* @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/26 16:58:26 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/07 08:10:06 $
* @since 4.1
*/
public class ResourceLimitingJdbcDataSource
@@ -134,7 +175,7 @@
final int max = controller.getAttributeAsInteger( "max", 3 );
final boolean blocking = controller.getAttributeAsBoolean( "blocking", true );
- final long timeout = controller.getAttributeAsLong ( "timeout", -1 );
+ final long timeout = controller.getAttributeAsLong ( "timeout", 0 );
final long trimInterval = controller.getAttributeAsLong ( "trim-interval", 60000 );
final boolean oradb = controller.getAttributeAsBoolean( "oradb", false );
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>