You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2002/11/07 20:22:31 UTC
cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool Jdbc2PoolDataSource.java
rwaldhoff 2002/11/07 11:22:31
Modified: dbcp/src/java/org/apache/commons/dbcp/jdbc2pool
Jdbc2PoolDataSource.java
Log:
address bug (enhancement) 13077 <http://issues.apache.org/bugzilla/show_bug.cgi?id=13077>, by adding isXXX versions of the boolean returning getXXX methods, and by sharing default values with GenericObjectPool
Revision Changes Path
1.3 +55 -26 jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/Jdbc2PoolDataSource.java
Index: Jdbc2PoolDataSource.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/Jdbc2PoolDataSource.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Jdbc2PoolDataSource.java 5 Sep 2002 23:38:49 -0000 1.2
+++ Jdbc2PoolDataSource.java 7 Nov 2002 19:22:31 -0000 1.3
@@ -162,38 +162,47 @@
private boolean getConnectionCalled = false;
- private ConnectionPoolDataSource cpds;
+ private ConnectionPoolDataSource cpds = null;
/** DataSource Name used to find the ConnectionPoolDataSource */
- private String dataSourceName;
- private boolean defaultAutoCommit;
- private int defaultMaxActive = 0;
- private int defaultMaxIdle = 0;
- private int defaultMaxWait = -1;
- private boolean defaultReadOnly;
+ private String dataSourceName = null;
+ private boolean defaultAutoCommit = false;
+ private int defaultMaxActive = GenericObjectPool.DEFAULT_MAX_ACTIVE;
+ private int defaultMaxIdle = GenericObjectPool.DEFAULT_MAX_IDLE;
+ private int defaultMaxWait =
+ (((long)Integer.MAX_VALUE) < GenericObjectPool.DEFAULT_MAX_WAIT) ?
+ (int)(GenericObjectPool.DEFAULT_MAX_WAIT) :
+ Integer.MAX_VALUE;
+ private boolean defaultReadOnly = false;
/** Description */
- private String description;
+ private String description = null;
/** Environment that may be used to set up a jndi initial context. */
- private Properties jndiEnvironment;
+ private Properties jndiEnvironment = null;
/** Login TimeOut in seconds */
- private int loginTimeout;
+ private int loginTimeout = 0;
/** Log stream */
- private PrintWriter logWriter;
- private Map perUserDefaultAutoCommit;
- private Map perUserMaxActive;
- private Map perUserMaxIdle;
- private Map perUserMaxWait;
- private Map perUserDefaultReadOnly;
- private boolean _testOnBorrow;
- private boolean _testOnReturn;
- private int _timeBetweenEvictionRunsMillis;
- private int _numTestsPerEvictionRun;
- private int _minEvictableIdleTimeMillis;
- private boolean _testWhileIdle;
+ private PrintWriter logWriter = null;
+ private Map perUserDefaultAutoCommit = null;
+ private Map perUserMaxActive = null;
+ private Map perUserMaxIdle = null;
+ private Map perUserMaxWait = null;
+ private Map perUserDefaultReadOnly = null;
+ private boolean _testOnBorrow = GenericObjectPool.DEFAULT_TEST_ON_BORROW;
+ private boolean _testOnReturn = GenericObjectPool.DEFAULT_TEST_ON_RETURN;
+ private int _timeBetweenEvictionRunsMillis =
+ (((long)Integer.MAX_VALUE) < GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS) ?
+ (int)(GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS) :
+ Integer.MAX_VALUE;;
+ private int _numTestsPerEvictionRun = GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN;
+ private int _minEvictableIdleTimeMillis =
+ (((long)Integer.MAX_VALUE) < GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS) ?
+ (int)(GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS) :
+ Integer.MAX_VALUE;;
+ private boolean _testWhileIdle = GenericObjectPool.DEFAULT_TEST_WHILE_IDLE;
private String validationQuery = null;
- private boolean testPositionSet;
+ private boolean testPositionSet = false;
- private boolean isNew;
- private Integer instanceKey;
+ private boolean isNew = false;
+ private Integer instanceKey = null;
/**
* Default no-arg constructor for Serialization
@@ -740,6 +749,13 @@
/**
+ * @see #getTestOnBorrow
+ */
+ final public boolean isTestOnBorrow() {
+ return getTestOnBorrow();
+ }
+
+ /**
* When <tt>true</tt>, objects will be
* {*link PoolableObjectFactory#validateObject validated}
* before being returned by the {*link #borrowObject}
@@ -770,6 +786,13 @@
}
/**
+ * @see #getTestOnReturn
+ */
+ final public boolean isTestOnReturn() {
+ return isTestOnReturn();
+ }
+
+ /**
* When <tt>true</tt>, objects will be
* {*link PoolableObjectFactory#validateObject validated}
* before being returned to the pool within the
@@ -876,6 +899,12 @@
_minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
+ /**
+ * @see #getTestWhileIdle
+ */
+ final public boolean isTestWhileIdle() {
+ return getTestWhileIdle();
+ }
/**
* When <tt>true</tt>, objects will be
* {*link PoolableObjectFactory#validateObject validated}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>