craigmcc 02/04/30 11:06:30
Modified: dbcp/src/java/org/apache/commons/dbcp BasicDataSource.java
Log:
Make the current number of active and idle connections visible through
the "numActive" and "numIdle" properties.
Submitted by: Eric Pugh <epugh at upstate.com>
Revision Changes Path
1.5 +30 -4
jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java
Index: BasicDataSource.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BasicDataSource.java 20 Apr 2002 18:58:51 -0000 1.4
+++ BasicDataSource.java 30 Apr 2002 18:06:30 -0000 1.5
@@ -1,6 +1,6 @@
-/** $Header:
/home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
1.4 2002/04/20 18:58:51 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/20 18:58:51 $
+/** $Header:
/home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
1.5 2002/04/30 18:06:30 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/30 18:06:30 $
*
* ====================================================================
*
@@ -80,7 +80,7 @@
* but provides a "one stop shopping" solution for basic requirements.</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2002/04/20 18:58:51 $
+ * @version $Revision: 1.5 $ $Date: 2002/04/30 18:06:30 $
*/
public class BasicDataSource implements DataSource {
@@ -176,6 +176,32 @@
this.maxWait = maxWait;
}
+
+
+ /**
+ * [Read Only] The current number of active connections that have been
+ * allocated from this data source.
+ */
+ public int getNumActive() {
+ if (connectionPool != null) {
+ return (connectionPool.numActive());
+ } else {
+ return (0);
+ }
+ }
+
+
+ /**
+ * [Read Only] The current number of idle connections that are waiting
+ * to be allocated from this data source.
+ */
+ public int getNumIdle() {
+ if (connectionPool != null) {
+ return (connectionPool.numIdle());
+ } else {
+ return (0);
+ }
+ }
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>