mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
支持idlecheck
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@385 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -83,6 +83,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
private ConnectionHolder[] connections;
|
||||
private int count = 0;
|
||||
private int activeCount = 0;
|
||||
private long idleCheckCount = 0;
|
||||
|
||||
// threads
|
||||
private CreateConnectionThread createConnectionThread;
|
||||
@@ -703,6 +704,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
} else {
|
||||
evictList.add(idleConnection);
|
||||
}
|
||||
idleCheckCount++;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -27,6 +27,7 @@ public class Case3 extends TestCase {
|
||||
private int TEST_COUNT = 3;
|
||||
final int LOOP_COUNT = 1000 * 1;
|
||||
private boolean testOnBorrow = true;
|
||||
private String connectionProperties = "bigStringTryClob=true;clientEncoding=GBK;defaultRowPrefetch=50;serverEncoding=ISO-8859-1";
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
@@ -41,7 +42,7 @@ public class Case3 extends TestCase {
|
||||
|
||||
public void test_perf() throws Exception {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
//druid();
|
||||
druid();
|
||||
dbcp();
|
||||
}
|
||||
}
|
||||
@@ -60,6 +61,7 @@ public class Case3 extends TestCase {
|
||||
dataSource.setPassword(password);
|
||||
dataSource.setValidationQuery(validationQuery);
|
||||
dataSource.setTestOnBorrow(testOnBorrow);
|
||||
dataSource.setConnectionProperties(connectionProperties);
|
||||
|
||||
for (int i = 0; i < TEST_COUNT; ++i) {
|
||||
p0(dataSource, "druid", threadCount);
|
||||
@@ -81,6 +83,7 @@ public class Case3 extends TestCase {
|
||||
dataSource.setPassword(password);
|
||||
dataSource.setValidationQuery(validationQuery);
|
||||
dataSource.setTestOnBorrow(testOnBorrow);
|
||||
dataSource.setConnectionProperties(connectionProperties);
|
||||
|
||||
for (int i = 0; i < TEST_COUNT; ++i) {
|
||||
p0(dataSource, "dbcp", threadCount);
|
||||
|
||||
Reference in New Issue
Block a user