You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2011/06/13 21:05:16 UTC
svn commit: r1135225 - in /commons/proper/dbcp/trunk/src:
java/org/apache/commons/dbcp2/ java/org/apache/commons/dbcp2/datasources/
test/org/apache/commons/dbcp2/ test/org/apache/commons/dbcp2/datasources/
test/org/apache/commons/dbcp2/managed/
Author: markt
Date: Mon Jun 13 19:05:15 2011
New Revision: 1135225
URL: http://svn.apache.org/viewvc?rev=1135225&view=rev
Log:
Update for pool2 changes
maxActive -> maxTotal for GOP
Modified:
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/AbandonedObjectPool.java
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSourceFactory.java
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSourceFactory.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSourceFactory.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/AbandonedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/AbandonedObjectPool.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/AbandonedObjectPool.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/AbandonedObjectPool.java Mon Jun 13 19:05:15 2011
@@ -74,7 +74,7 @@ public class AbandonedObjectPool extends
if (config != null
&& config.getRemoveAbandoned()
&& (getNumIdle() < 2)
- && (getNumActive() > getMaxActive() - 3) ) {
+ && (getNumActive() > getMaxTotal() - 3) ) {
removeAbandoned();
}
Object obj = super.borrowObject();
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java Mon Jun 13 19:05:15 2011
@@ -322,7 +322,7 @@ public class BasicDataSource implements
* The maximum number of active connections that can be allocated from
* this pool at the same time, or negative for no limit.
*/
- protected int maxActive = GenericObjectPoolConfig.DEFAULT_MAX_TOTAL;
+ protected int maxTotal = GenericObjectPoolConfig.DEFAULT_MAX_TOTAL;
/**
* <p>Returns the maximum number of active connections that can be
@@ -332,21 +332,21 @@ public class BasicDataSource implements
*
* @return the maximum number of active connections
*/
- public synchronized int getMaxActive() {
- return this.maxActive;
+ public synchronized int getMaxTotal() {
+ return this.maxTotal;
}
/**
- * Sets the maximum number of active connections that can be
- * allocated at the same time. Use a negative value for no limit.
+ * Sets the maximum total number of idle and borrows connections that can be
+ * active at the same time. Use a negative value for no limit.
*
- * @param maxActive the new value for maxActive
- * @see #getMaxActive()
+ * @param maxTotal the new value for maxTotal
+ * @see #getMaxTotal()
*/
- public synchronized void setMaxActive(int maxActive) {
- this.maxActive = maxActive;
+ public synchronized void setMaxTotal(int maxTotal) {
+ this.maxTotal = maxTotal;
if (connectionPool != null) {
- connectionPool.setMaxActive(maxActive);
+ connectionPool.setMaxTotal(maxTotal);
}
}
@@ -1276,7 +1276,7 @@ public class BasicDataSource implements
* <p>Abandoned connections are identified and removed when
* {@link #getConnection()} is invoked and the following conditions hold
* <ul><li>{@link #getRemoveAbandoned()} = true </li>
- * <li>{@link #getNumActive()} > {@link #getMaxActive()} - 3 </li>
+ * <li>{@link #getNumActive()} > {@link #getMaxTotal()} - 3 </li>
* <li>{@link #getNumIdle()} < 2 </li></ul></p>
*
* @see #getRemoveAbandonedTimeout()
@@ -1322,7 +1322,7 @@ public class BasicDataSource implements
* <code><ul>
* <li><code>{@link #getRemoveAbandoned() removeAbandoned} == true</li>
* <li>{@link #getNumIdle() numIdle} < 2</li>
- * <li>{@link #getNumActive() numActive} > {@link #getMaxActive() maxActive} - 3</li>
+ * <li>{@link #getNumActive() numActive} > {@link #getMaxTotal() maxActive} - 3</li>
* </ul></code></p>
*
* <p>The default value is 300 seconds.</p>
@@ -1707,7 +1707,7 @@ public class BasicDataSource implements
else {
gop = new GenericObjectPool();
}
- gop.setMaxActive(maxActive);
+ gop.setMaxTotal(maxTotal);
gop.setMaxIdle(maxIdle);
gop.setMinIdle(minIdle);
gop.setMaxWait(maxWait);
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java Mon Jun 13 19:05:15 2011
@@ -237,7 +237,7 @@ public class BasicDataSourceFactory impl
value = properties.getProperty(PROP_MAXACTIVE);
if (value != null) {
- dataSource.setMaxActive(Integer.parseInt(value));
+ dataSource.setMaxTotal(Integer.parseInt(value));
}
value = properties.getProperty(PROP_MAXIDLE);
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java Mon Jun 13 19:05:15 2011
@@ -62,13 +62,13 @@ public class PerUserPoolDataSource
private static final long serialVersionUID = -3104731034410444060L;
- private int defaultMaxActive = GenericObjectPoolConfig.DEFAULT_MAX_TOTAL;
+ private int defaultMaxTotal = GenericObjectPoolConfig.DEFAULT_MAX_TOTAL;
private int defaultMaxIdle = GenericObjectPoolConfig.DEFAULT_MAX_IDLE;
private int defaultMaxWait = (int)Math.min(Integer.MAX_VALUE,
GenericObjectPoolConfig.DEFAULT_MAX_WAIT);
Map perUserDefaultAutoCommit = null;
Map perUserDefaultTransactionIsolation = null;
- Map perUserMaxActive = null;
+ Map perUserMaxTotal = null;
Map perUserMaxIdle = null;
Map perUserMaxWait = null;
Map perUserDefaultReadOnly = null;
@@ -109,8 +109,8 @@ public class PerUserPoolDataSource
* This value is used for any username which is not specified
* in perUserMaxConnections.
*/
- public int getDefaultMaxActive() {
- return (this.defaultMaxActive);
+ public int getDefaultMaxTotal() {
+ return (this.defaultMaxTotal);
}
/**
@@ -119,9 +119,9 @@ public class PerUserPoolDataSource
* This value is used for any username which is not specified
* in perUserMaxConnections. The default is 8.
*/
- public void setDefaultMaxActive(int maxActive) {
+ public void setDefaultMaxTotal(int maxActive) {
assertInitializationAllowed();
- this.defaultMaxActive = maxActive;
+ this.defaultMaxTotal = maxActive;
}
/**
@@ -223,12 +223,12 @@ public class PerUserPoolDataSource
* The maximum number of active connections that can be allocated from
* this pool at the same time, or non-positive for no limit.
* The keys are usernames and the value is the maximum connections. Any
- * username specified here will override the value of defaultMaxActive.
+ * username specified here will override the value of defaultMaxTotal.
*/
- public Integer getPerUserMaxActive(String username) {
+ public Integer getPerUserMaxTotal(String username) {
Integer value = null;
- if (perUserMaxActive != null) {
- value = (Integer) perUserMaxActive.get(username);
+ if (perUserMaxTotal != null) {
+ value = (Integer) perUserMaxTotal.get(username);
}
return value;
}
@@ -237,14 +237,14 @@ public class PerUserPoolDataSource
* The maximum number of active connections that can be allocated from
* this pool at the same time, or non-positive for no limit.
* The keys are usernames and the value is the maximum connections. Any
- * username specified here will override the value of defaultMaxActive.
+ * username specified here will override the value of defaultMaxTotal.
*/
- public void setPerUserMaxActive(String username, Integer value) {
+ public void setPerUserMaxTotal(String username, Integer value) {
assertInitializationAllowed();
- if (perUserMaxActive == null) {
- perUserMaxActive = new HashMap();
+ if (perUserMaxTotal == null) {
+ perUserMaxTotal = new HashMap();
}
- perUserMaxActive.put(username, value);
+ perUserMaxTotal.put(username, value);
}
@@ -496,9 +496,9 @@ public class PerUserPoolDataSource
ConnectionPoolDataSource cpds = testCPDS(username, password);
- Integer userMax = getPerUserMaxActive(username);
- int maxActive = (userMax == null) ?
- getDefaultMaxActive() : userMax.intValue();
+ Integer userMax = getPerUserMaxTotal(username);
+ int maxTotal = (userMax == null) ?
+ getDefaultMaxTotal() : userMax.intValue();
userMax = getPerUserMaxIdle(username);
int maxIdle = (userMax == null) ?
getDefaultMaxIdle() : userMax.intValue();
@@ -508,12 +508,12 @@ public class PerUserPoolDataSource
// Create an object pool to contain our PooledConnections
GenericObjectPool pool = new GenericObjectPool(null);
- pool.setMaxActive(maxActive);
+ pool.setMaxTotal(maxTotal);
pool.setMaxIdle(maxIdle);
pool.setMaxWait(maxWait);
- if (maxActive <= 0) {
+ if (maxTotal <= 0) {
pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
- pool.setMaxActive(Integer.MAX_VALUE);
+ pool.setMaxTotal(Integer.MAX_VALUE);
}
if (maxWait == 0) {
pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSourceFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSourceFactory.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSourceFactory.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSourceFactory.java Mon Jun 13 19:05:15 2011
@@ -43,9 +43,9 @@ public class PerUserPoolDataSourceFactor
protected InstanceKeyDataSource getNewInstance(Reference ref)
throws IOException, ClassNotFoundException {
PerUserPoolDataSource pupds = new PerUserPoolDataSource();
- RefAddr ra = ref.get("defaultMaxActive");
+ RefAddr ra = ref.get("defaultMaxTotal");
if (ra != null && ra.getContent() != null) {
- pupds.setDefaultMaxActive(
+ pupds.setDefaultMaxTotal(
Integer.parseInt(ra.getContent().toString()));
}
@@ -74,10 +74,10 @@ public class PerUserPoolDataSourceFactor
(Map) deserialize(serialized);
}
- ra = ref.get("perUserMaxActive");
+ ra = ref.get("perUserMaxTotal");
if (ra != null && ra.getContent() != null) {
byte[] serialized = (byte[]) ra.getContent();
- pupds.perUserMaxActive = (Map) deserialize(serialized);
+ pupds.perUserMaxTotal = (Map) deserialize(serialized);
}
ra = ref.get("perUserMaxIdle");
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java Mon Jun 13 19:05:15 2011
@@ -55,7 +55,7 @@ public class SharedPoolDataSource
private static final long serialVersionUID = -8132305535403690372L;
- private int maxActive = GenericObjectPoolConfig.DEFAULT_MAX_TOTAL;
+ private int maxTotal = GenericObjectPoolConfig.DEFAULT_MAX_TOTAL;
private int maxIdle = GenericObjectPoolConfig.DEFAULT_MAX_IDLE;
private int maxWait = (int)Math.min(Integer.MAX_VALUE,
GenericObjectPoolConfig.DEFAULT_MAX_WAIT);
@@ -86,8 +86,8 @@ public class SharedPoolDataSource
* The maximum number of active connections that can be allocated from
* this pool at the same time, or non-positive for no limit.
*/
- public int getMaxActive() {
- return (this.maxActive);
+ public int getMaxTotal() {
+ return (this.maxTotal);
}
/**
@@ -95,9 +95,9 @@ public class SharedPoolDataSource
* this pool at the same time, or non-positive for no limit.
* The default is 8.
*/
- public void setMaxActive(int maxActive) {
+ public void setMaxTotal(int maxTotal) {
assertInitializationAllowed();
- this.maxActive = maxActive;
+ this.maxTotal = maxTotal;
}
/**
@@ -216,11 +216,11 @@ public class SharedPoolDataSource
// Create an object pool to contain our PooledConnections
GenericKeyedObjectPool tmpPool = new GenericKeyedObjectPool();
- tmpPool.setMaxTotalPerKey(getMaxActive());
+ tmpPool.setMaxTotalPerKey(getMaxTotal());
tmpPool.setMaxIdlePerKey(getMaxIdle());
tmpPool.setMaxWait(getMaxWait());
tmpPool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
- if (maxActive <= 0) {
+ if (maxTotal <= 0) {
tmpPool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
tmpPool.setMaxTotalPerKey(Integer.MAX_VALUE);
}
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSourceFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSourceFactory.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSourceFactory.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSourceFactory.java Mon Jun 13 19:05:15 2011
@@ -40,7 +40,7 @@ public class SharedPoolDataSourceFactory
SharedPoolDataSource spds = new SharedPoolDataSource();
RefAddr ra = ref.get("maxActive");
if (ra != null && ra.getContent() != null) {
- spds.setMaxActive(
+ spds.setMaxTotal(
Integer.parseInt(ra.getContent().toString()));
}
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedBasicDataSource.java Mon Jun 13 19:05:15 2011
@@ -64,7 +64,7 @@ public class TestAbandonedBasicDataSourc
public void testAbandoned() throws Exception {
// force abandoned
ds.setRemoveAbandonedTimeout(0);
- ds.setMaxActive(1);
+ ds.setMaxTotal(1);
for (int i = 0; i < 3; i++) {
assertNotNull(ds.getConnection());
@@ -74,7 +74,7 @@ public class TestAbandonedBasicDataSourc
public void testAbandonedClose() throws Exception {
// force abandoned
ds.setRemoveAbandonedTimeout(0);
- ds.setMaxActive(1);
+ ds.setMaxTotal(1);
ds.setAccessToUnderlyingConnectionAllowed(true);
Connection conn1 = getConnection();
@@ -100,7 +100,7 @@ public class TestAbandonedBasicDataSourc
public void testAbandonedCloseWithExceptions() throws Exception {
// force abandoned
ds.setRemoveAbandonedTimeout(0);
- ds.setMaxActive(1);
+ ds.setMaxTotal(1);
ds.setAccessToUnderlyingConnectionAllowed(true);
Connection conn1 = getConnection();
@@ -130,7 +130,7 @@ public class TestAbandonedBasicDataSourc
*/
public void testlastUsed() throws Exception {
ds.setRemoveAbandonedTimeout(1);
- ds.setMaxActive(2);
+ ds.setMaxTotal(2);
Connection conn1 = ds.getConnection();
Thread.sleep(500);
conn1.createStatement(); // Should reset lastUsed
@@ -151,7 +151,7 @@ public class TestAbandonedBasicDataSourc
*/
public void testlastUsedPrepareCall() throws Exception {
ds.setRemoveAbandonedTimeout(1);
- ds.setMaxActive(2);
+ ds.setMaxTotal(2);
Connection conn1 = ds.getConnection();
Thread.sleep(500);
conn1.prepareCall("{call home}"); // Should reset lastUsed
@@ -172,7 +172,7 @@ public class TestAbandonedBasicDataSourc
*/
public void testLastUsedPreparedStatementUse() throws Exception {
ds.setRemoveAbandonedTimeout(1);
- ds.setMaxActive(2);
+ ds.setMaxTotal(2);
Connection conn1 = ds.getConnection();
Statement st = conn1.createStatement();
String querySQL = "SELECT 1 FROM DUAL";
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java Mon Jun 13 19:05:15 2011
@@ -72,7 +72,7 @@ public class TestAbandonedObjectPool ext
*/
public void testConcurrentInvalidation() throws Exception {
final int POOL_SIZE = 30;
- pool.setMaxActive(POOL_SIZE);
+ pool.setMaxTotal(POOL_SIZE);
pool.setMaxIdle(POOL_SIZE);
pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java Mon Jun 13 19:05:15 2011
@@ -57,7 +57,7 @@ public class TestBasicDataSource extends
ds = createDataSource();
ds.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
ds.setUrl("jdbc:apache:commons:testdriver");
- ds.setMaxActive(getMaxActive());
+ ds.setMaxTotal(getMaxTotal());
ds.setMaxWait(getMaxWait());
ds.setDefaultAutoCommit(true);
ds.setDefaultReadOnly(false);
@@ -351,7 +351,7 @@ public class TestBasicDataSource extends
}
public void testDefaultCatalog() throws Exception {
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = getConnection();
assertTrue(c[i] != null);
@@ -392,7 +392,7 @@ public class TestBasicDataSource extends
}
public void testInitialSize() throws Exception {
- ds.setMaxActive(20);
+ ds.setMaxTotal(20);
ds.setMaxIdle(20);
ds.setInitialSize(10);
@@ -459,12 +459,12 @@ public class TestBasicDataSource extends
}
/**
- * Bugzilla Bug 29832: Broken behaviour for BasicDataSource.setMaxActive(0)
- * MaxActive == 0 should throw SQLException on getConnection.
+ * Bugzilla Bug 29832: Broken behaviour for BasicDataSource.setMaxTotal(0)
+ * MaxTotal == 0 should throw SQLException on getConnection.
* Results from Bug 29863 in commons-pool.
*/
- public void testMaxActiveZero() throws Exception {
- ds.setMaxActive(0);
+ public void testMaxTotalZero() throws Exception {
+ ds.setMaxTotal(0);
try {
Connection conn = ds.getConnection();
@@ -485,7 +485,7 @@ public class TestBasicDataSource extends
ds = createDataSource();
ds.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
ds.setUrl("jdbc:apache:commons:testdriver");
- ds.setMaxActive(getMaxActive());
+ ds.setMaxTotal(getMaxTotal());
ds.setMaxWait(getMaxWait());
ds.setDefaultAutoCommit(true);
ds.setDefaultReadOnly(false);
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSourceFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSourceFactory.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSourceFactory.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSourceFactory.java Mon Jun 13 19:05:15 2011
@@ -86,7 +86,7 @@ public class TestBasicDataSourceFactory
assertEquals("org.apache.commons.dbcp2.TesterDriver", ds.getDriverClassName());
assertEquals("jdbc:apache:commons:testdriver", ds.getUrl());
- assertEquals(10, ds.getMaxActive());
+ assertEquals(10, ds.getMaxTotal());
assertEquals(8, ds.getMaxIdle());
assertEquals(0, ds.getMinIdle());
assertEquals(500, ds.getMaxWait());
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java Mon Jun 13 19:05:15 2011
@@ -65,7 +65,7 @@ public abstract class TestConnectionPool
protected abstract Connection getConnection() throws Exception;
- protected int getMaxActive() {
+ protected int getMaxTotal() {
return 10;
}
@@ -97,7 +97,7 @@ public abstract class TestConnectionPool
// ----------- tests ---------------------------------
public void testClearWarnings() throws Exception {
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
assertTrue(c[i] != null);
@@ -129,7 +129,7 @@ public abstract class TestConnectionPool
}
public void testIsClosed() throws Exception {
- for(int i=0;i<getMaxActive();i++) {
+ for(int i=0;i<getMaxTotal();i++) {
Connection conn = newConnection();
assertNotNull(conn);
assertTrue(!conn.isClosed());
@@ -150,7 +150,7 @@ public abstract class TestConnectionPool
* an exception being thrown.
*/
public void testCanCloseConnectionTwice() throws Exception {
- for (int i = 0; i < getMaxActive(); i++) { // loop to show we *can* close again once we've borrowed it from the pool again
+ for (int i = 0; i < getMaxTotal(); i++) { // loop to show we *can* close again once we've borrowed it from the pool again
Connection conn = newConnection();
assertNotNull(conn);
assertTrue(!conn.isClosed());
@@ -393,8 +393,8 @@ public abstract class TestConnectionPool
public void testPooling() throws Exception {
// Grab a maximal set of open connections from the pool
- Connection[] c = new Connection[getMaxActive()];
- Connection[] u = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
+ Connection[] u = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
if (c[i] instanceof DelegatingConnection) {
@@ -446,7 +446,7 @@ public abstract class TestConnectionPool
/** @see "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */
public void testConnectionsAreDistinct() throws Exception {
- Connection[] conn = new Connection[getMaxActive()];
+ Connection[] conn = new Connection[getMaxTotal()];
for(int i=0;i<conn.length;i++) {
conn[i] = newConnection();
for(int j=0;j<i;j++) {
@@ -461,7 +461,7 @@ public abstract class TestConnectionPool
public void testOpening() throws Exception {
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// test that opening new connections is not closing previous
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
@@ -477,7 +477,7 @@ public abstract class TestConnectionPool
}
public void testClosing() throws Exception {
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// open the maximum connections
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
@@ -495,8 +495,8 @@ public abstract class TestConnectionPool
}
}
- public void testMaxActive() throws Exception {
- Connection[] c = new Connection[getMaxActive()];
+ public void testMaxTotal() throws Exception {
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
assertTrue(c[i] != null);
@@ -504,7 +504,7 @@ public abstract class TestConnectionPool
try {
newConnection();
- fail("Allowed to open more than DefaultMaxActive connections.");
+ fail("Allowed to open more than DefaultMaxTotal connections.");
} catch (java.sql.SQLException e) {
// should only be able to open 10 connections, so this test should
// throw an exception
@@ -531,7 +531,7 @@ public abstract class TestConnectionPool
}
public void testThreaded() {
- TestThread[] threads = new TestThread[getMaxActive()];
+ TestThread[] threads = new TestThread[getMaxTotal()];
for(int i=0;i<threads.length;i++) {
threads[i] = new TestThread(50,50);
Thread t = new Thread(threads[i]);
@@ -692,7 +692,7 @@ public abstract class TestConnectionPool
// @see http://jira.codehaus.org/browse/SUREFIRE-121
/**
- * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
+ * Launches a group of 2 * getMaxTotal() threads, each of which will attempt to obtain a connection
* from the pool, hold it for <holdTime> ms, and then return it to the pool. If <loopOnce> is false,
* threads will continue this process indefinitely. If <expectError> is true, exactly 1/2 of the
* threads are expected to either throw exceptions or fail to complete. If <expectError> is false,
@@ -708,7 +708,7 @@ public abstract class TestConnectionPool
protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
throws Exception {
long startTime = timeStamp();
- final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
+ final PoolTest[] pts = new PoolTest[2 * getMaxTotal()];
// Catch Exception so we can stop all threads if one fails
ThreadGroup threadGroup = new ThreadGroup("foo") {
@Override
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java Mon Jun 13 19:05:15 2011
@@ -172,7 +172,7 @@ public class TestPStmtPoolingBasicDataSo
}
public void testPStmtPoolingWithNoClose() throws Exception {
- ds.setMaxActive(1); // only one connection in pool needed
+ ds.setMaxTotal(1); // only one connection in pool needed
ds.setMaxIdle(1);
ds.setAccessToUnderlyingConnectionAllowed(true);
Connection conn1 = getConnection();
@@ -203,7 +203,7 @@ public class TestPStmtPoolingBasicDataSo
}
public void testPStmtPoolingAccrossClose() throws Exception {
- ds.setMaxActive(1); // only one connection in pool needed
+ ds.setMaxTotal(1); // only one connection in pool needed
ds.setMaxIdle(1);
ds.setAccessToUnderlyingConnectionAllowed(true);
Connection conn1 = getConnection();
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java Mon Jun 13 19:05:15 2011
@@ -52,7 +52,7 @@ public class TestPoolingDataSource exten
public void setUp() throws Exception {
super.setUp();
pool = new GenericObjectPool();
- pool.setMaxActive(getMaxActive());
+ pool.setMaxTotal(getMaxTotal());
pool.setMaxWait(getMaxWait());
Properties props = new Properties();
props.setProperty("user", "username");
@@ -75,7 +75,7 @@ public class TestPoolingDataSource exten
public void testPoolGuardConnectionWrapperEqualsSameDelegate() throws Exception {
// Get a maximal set of connections from the pool
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
}
@@ -111,7 +111,7 @@ public class TestPoolingDataSource exten
// Force PoolGuardConnectionWrappers to wrap non-Delegating connections
pool.close();
pool = new GenericObjectPool();
- pool.setMaxActive(getMaxActive());
+ pool.setMaxTotal(getMaxTotal());
pool.setMaxWait(getMaxWait());
Properties props = new Properties();
props.setProperty("user", "username");
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java Mon Jun 13 19:05:15 2011
@@ -61,7 +61,7 @@ public class TestPoolingDriver extends T
public void setUp() throws Exception {
super.setUp();
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
- poolConfig.setMaxTotal(getMaxActive());
+ poolConfig.setMaxTotal(getMaxTotal());
poolConfig.setMaxWait(getMaxWait());
poolConfig.setMinIdle(10);
poolConfig.setTestOnBorrow(true);
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java Mon Jun 13 19:05:15 2011
@@ -65,7 +65,7 @@ public class TestCPDSConnectionFactory e
public void testSharedPoolDSDestroyOnReturn() throws Exception {
PerUserPoolDataSource ds = new PerUserPoolDataSource();
ds.setConnectionPoolDataSource(cpds);
- ds.setPerUserMaxActive("username",new Integer(10));// Integer.valueOf() is Java 1.5
+ ds.setPerUserMaxTotal("username",new Integer(10));// Integer.valueOf() is Java 1.5
ds.setPerUserMaxWait("username",new Integer(50));
ds.setPerUserMaxIdle("username",new Integer(2));
Connection conn1 = ds.getConnection("username", "password");
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestKeyedCPDSConnectionFactory.java Mon Jun 13 19:05:15 2011
@@ -65,7 +65,7 @@ public class TestKeyedCPDSConnectionFact
public void testSharedPoolDSDestroyOnReturn() throws Exception {
SharedPoolDataSource ds = new SharedPoolDataSource();
ds.setConnectionPoolDataSource(cpds);
- ds.setMaxActive(10);
+ ds.setMaxTotal(10);
ds.setMaxWait(50);
ds.setMaxIdle(2);
Connection conn1 = ds.getConnection("username", "password");
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java Mon Jun 13 19:05:15 2011
@@ -68,9 +68,9 @@ public class TestPerUserPoolDataSource e
PerUserPoolDataSource tds = new PerUserPoolDataSource();
tds.setConnectionPoolDataSource(pcds);
- tds.setDefaultMaxActive(getMaxActive());
+ tds.setDefaultMaxTotal(getMaxTotal());
tds.setDefaultMaxWait((int)(getMaxWait()));
- tds.setPerUserMaxActive("foo",new Integer(getMaxActive()));
+ tds.setPerUserMaxTotal("foo",new Integer(getMaxTotal()));
tds.setPerUserMaxWait("foo",new Integer((int)(getMaxWait())));
tds.setDefaultTransactionIsolation(
Connection.TRANSACTION_READ_COMMITTED);
@@ -165,7 +165,7 @@ public class TestPerUserPoolDataSource e
public void testClosingWithUserName()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// open the maximum connections
for (int i=0; i<c.length; i++)
{
@@ -256,7 +256,7 @@ public class TestPerUserPoolDataSource e
public void testOpening()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// test that opening new connections is not closing previous
for (int i=0; i<c.length; i++)
{
@@ -278,7 +278,7 @@ public class TestPerUserPoolDataSource e
public void testClosing()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// open the maximum connections
for (int i=0; i<c.length; i++)
{
@@ -299,10 +299,10 @@ public class TestPerUserPoolDataSource e
}
@Override
- public void testMaxActive()
+ public void testMaxTotal()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i=0; i<c.length; i++)
{
c[i] = ds.getConnection();
@@ -312,7 +312,7 @@ public class TestPerUserPoolDataSource e
try
{
ds.getConnection();
- fail("Allowed to open more than DefaultMaxActive connections.");
+ fail("Allowed to open more than DefaultMaxTotal connections.");
}
catch(java.sql.SQLException e)
{
@@ -333,7 +333,7 @@ public class TestPerUserPoolDataSource e
public void testMaxWaitZero() throws Exception {
PerUserPoolDataSource tds = (PerUserPoolDataSource) ds;
tds.setDefaultMaxWait(0);
- tds.setPerUserMaxActive("u1", new Integer(1));
+ tds.setPerUserMaxTotal("u1", new Integer(1));
Connection conn = tds.getConnection("u1", "p1");
try {
tds.getConnection("u1", "p1");
@@ -348,8 +348,8 @@ public class TestPerUserPoolDataSource e
PerUserPoolDataSource tds = (PerUserPoolDataSource) ds;
// you need to set maxActive otherwise there is no accounting
- tds.setPerUserMaxActive("u1", new Integer(5));
- tds.setPerUserMaxActive("u2", new Integer(5));
+ tds.setPerUserMaxTotal("u1", new Integer(5));
+ tds.setPerUserMaxTotal("u2", new Integer(5));
assertEquals(0, tds.getNumActive());
assertEquals(0, tds.getNumActive("u1", "p1"));
@@ -486,7 +486,7 @@ public class TestPerUserPoolDataSource e
TesterDriver.addUser("jsmith", "password");
PerUserPoolDataSource puds = (PerUserPoolDataSource) ds;
- puds.setPerUserMaxActive("jsmith", new Integer(2));
+ puds.setPerUserMaxTotal("jsmith", new Integer(2));
String[] users = {"mkh", "hanafey", "jsmith"};
String password = "password";
Connection[] c = new Connection[users.length];
@@ -506,7 +506,7 @@ public class TestPerUserPoolDataSource e
TesterDriver.addUser("jsmith", "password");
PerUserPoolDataSource puds = (PerUserPoolDataSource) ds;
- puds.setPerUserMaxActive("jsmith", new Integer(2));
+ puds.setPerUserMaxTotal("jsmith", new Integer(2));
String[] users = {"jsmith", "hanafey", "mkh"};
String password = "password";
Connection[] c = new Connection[users.length];
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java Mon Jun 13 19:05:15 2011
@@ -66,7 +66,7 @@ public class TestSharedPoolDataSource ex
SharedPoolDataSource tds = new SharedPoolDataSource();
tds.setConnectionPoolDataSource(pcds);
- tds.setMaxActive(getMaxActive());
+ tds.setMaxTotal(getMaxTotal());
tds.setMaxWait((int)(getMaxWait()));
tds.setDefaultTransactionIsolation(
Connection.TRANSACTION_READ_COMMITTED);
@@ -167,7 +167,7 @@ public class TestSharedPoolDataSource ex
public void testClosingWithUserName()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// open the maximum connections
for (int i=0; i<c.length; i++)
{
@@ -258,7 +258,7 @@ public class TestSharedPoolDataSource ex
public void testOpening()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// test that opening new connections is not closing previous
for (int i=0; i<c.length; i++)
{
@@ -280,7 +280,7 @@ public class TestSharedPoolDataSource ex
public void testClosing()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
// open the maximum connections
for (int i=0; i<c.length; i++)
{
@@ -313,10 +313,10 @@ public class TestSharedPoolDataSource ex
}
@Override
- public void testMaxActive()
+ public void testMaxTotal()
throws Exception
{
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i=0; i<c.length; i++)
{
c[i] = ds.getConnection();
@@ -326,7 +326,7 @@ public class TestSharedPoolDataSource ex
try
{
ds.getConnection();
- fail("Allowed to open more than DefaultMaxActive connections.");
+ fail("Allowed to open more than DefaultMaxTotal connections.");
}
catch(java.sql.SQLException e)
{
@@ -346,7 +346,7 @@ public class TestSharedPoolDataSource ex
((SharedPoolDataSource)ds).setMaxWait(maxWait);
// Obtain all the connections from the pool
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i=0; i<c.length; i++) {
c[i] = ds.getConnection("foo","bar");
assertTrue(c[i] != null);
@@ -493,7 +493,7 @@ public class TestSharedPoolDataSource ex
SharedPoolDataSource tds = new SharedPoolDataSource();
tds.setConnectionPoolDataSource(mypcds);
- tds.setMaxActive(getMaxActive());
+ tds.setMaxTotal(getMaxTotal());
tds.setMaxWait((int)(getMaxWait()));
tds.setDefaultTransactionIsolation(
Connection.TRANSACTION_READ_COMMITTED);
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java Mon Jun 13 19:05:15 2011
@@ -76,7 +76,7 @@ public class TestManagedDataSource exten
// create the pool
pool = new GenericObjectPool();
- pool.setMaxActive(getMaxActive());
+ pool.setMaxTotal(getMaxTotal());
pool.setMaxWait(getMaxWait());
// create the pool object factory
@@ -131,7 +131,7 @@ public class TestManagedDataSource exten
public void testManagedConnectionEqualsSameDelegateNoUnderlyingAccess() throws Exception {
// Get a maximal set of connections from the pool
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
}
@@ -153,7 +153,7 @@ public class TestManagedDataSource exten
public void testManagedConnectionEqualsSameDelegate() throws Exception {
// Get a maximal set of connections from the pool
- Connection[] c = new Connection[getMaxActive()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
c[i] = newConnection();
}
@@ -182,7 +182,7 @@ public class TestManagedDataSource exten
// Force ManagedConnections to wrap non-Delegating connections
pool.close();
pool = new GenericObjectPool();
- pool.setMaxActive(getMaxActive());
+ pool.setMaxTotal(getMaxTotal());
pool.setMaxWait(getMaxWait());
Properties props = new Properties();
props.setProperty("user", "username");
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java?rev=1135225&r1=1135224&r2=1135225&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java Mon Jun 13 19:05:15 2011
@@ -73,7 +73,7 @@ public class TestManagedDataSourceInTx e
@Override
public void testConnectionsAreDistinct() throws Exception {
- Connection[] conn = new Connection[getMaxActive()];
+ Connection[] conn = new Connection[getMaxTotal()];
for(int i=0;i<conn.length;i++) {
conn[i] = newConnection();
for(int j=0;j<i;j++) {
@@ -100,9 +100,9 @@ public class TestManagedDataSourceInTx e
}
@Override
- public void testMaxActive() throws Exception {
- Transaction[] transactions = new Transaction[getMaxActive()];
- Connection[] c = new Connection[getMaxActive()];
+ public void testMaxTotal() throws Exception {
+ Transaction[] transactions = new Transaction[getMaxTotal()];
+ Connection[] c = new Connection[getMaxTotal()];
for (int i = 0; i < c.length; i++) {
// create a new connection in the current transaction
c[i] = newConnection();
@@ -116,7 +116,7 @@ public class TestManagedDataSourceInTx e
try {
newConnection();
- fail("Allowed to open more than DefaultMaxActive connections.");
+ fail("Allowed to open more than DefaultMaxTotal connections.");
} catch (java.sql.SQLException e) {
// should only be able to open 10 connections, so this test should
// throw an exception