mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #5149 from kimmking/kmaster
fix some typo and unit tests
This commit is contained in:
@@ -875,7 +875,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
|
||||
if (keepAlive && keepAliveBetweenTimeMillis <= timeBetweenEvictionRunsMillis) {
|
||||
throw new SQLException("keepAliveBetweenTimeMillis must be grater than timeBetweenEvictionRunsMillis");
|
||||
throw new SQLException("keepAliveBetweenTimeMillis must be greater than timeBetweenEvictionRunsMillis");
|
||||
}
|
||||
|
||||
if (this.driverClass != null) {
|
||||
@@ -1480,10 +1480,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
|
||||
if (testOnBorrow) {
|
||||
boolean validate = testConnectionInternal(poolableConnection.holder, poolableConnection.conn);
|
||||
if (!validate) {
|
||||
boolean validated = testConnectionInternal(poolableConnection.holder, poolableConnection.conn);
|
||||
if (!validated) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("skip not validate connection.");
|
||||
LOG.debug("skip not validated connection.");
|
||||
}
|
||||
|
||||
discardConnection(poolableConnection.holder);
|
||||
@@ -1522,10 +1522,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
if (idleMillis >= timeBetweenEvictionRunsMillis
|
||||
|| idleMillis < 0 // unexcepted branch
|
||||
) {
|
||||
boolean validate = testConnectionInternal(poolableConnection.holder, poolableConnection.conn);
|
||||
if (!validate) {
|
||||
boolean validated = testConnectionInternal(poolableConnection.holder, poolableConnection.conn);
|
||||
if (!validated) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("skip not validate connection.");
|
||||
LOG.debug("skip not validated connection.");
|
||||
}
|
||||
|
||||
discardConnection(poolableConnection.holder);
|
||||
@@ -1579,7 +1579,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
discardErrorCountUpdater.incrementAndGet(this);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("discard close connection error", e);
|
||||
LOG.debug("discard to close connection error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1987,7 +1987,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
if (oldInfo == null) {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("remove abandonded failed. activeConnections.size " + activeConnections.size());
|
||||
LOG.warn("remove abandoned failed. activeConnections.size " + activeConnections.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2040,8 +2040,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
|
||||
if (testOnReturn) {
|
||||
boolean validate = testConnectionInternal(holder, physicalConnection);
|
||||
if (!validate) {
|
||||
boolean validated = testConnectionInternal(holder, physicalConnection);
|
||||
if (!validated) {
|
||||
JdbcUtils.close(physicalConnection);
|
||||
|
||||
destroyCountUpdater.incrementAndGet(this);
|
||||
@@ -2096,7 +2096,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
if (!result) {
|
||||
JdbcUtils.close(holder.conn);
|
||||
LOG.info("connection recyle failed.");
|
||||
LOG.info("connection recycle failed.");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
holder.clearStatementCache();
|
||||
@@ -2106,7 +2106,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
holder.discard = true;
|
||||
}
|
||||
|
||||
LOG.error("recyle error", e);
|
||||
LOG.error("recycle error", e);
|
||||
recycleErrorCountUpdater.incrementAndGet(this);
|
||||
}
|
||||
}
|
||||
@@ -2820,7 +2820,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
LOG.error("create connection unexecpted error.", e);
|
||||
LOG.error("create connection unexpected error.", e);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2897,7 +2897,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
lastErrorTimeMillis = System.currentTimeMillis();
|
||||
|
||||
if ((!closing) && (!closed)) {
|
||||
LOG.error("create connection Thread Interrupted, url: " + jdbcUrl, e);
|
||||
LOG.error("create connection thread interrupted, url: " + jdbcUrl, e);
|
||||
}
|
||||
break;
|
||||
} finally {
|
||||
|
||||
@@ -173,6 +173,11 @@ public class DruidDataSourceFactory implements ObjectFactory {
|
||||
public static void config(DruidDataSource dataSource, Map<?, ?> properties) throws SQLException {
|
||||
String value = null;
|
||||
|
||||
value = (String) properties.get(PROP_NAME);
|
||||
if (value != null) {
|
||||
dataSource.setName(value);
|
||||
}
|
||||
|
||||
value = (String) properties.get(PROP_DEFAULTAUTOCOMMIT);
|
||||
if (value != null) {
|
||||
dataSource.setDefaultAutoCommit(Boolean.valueOf(value).booleanValue());
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@ public class OracleExceptionSorterTest_closeConn extends TestCase {
|
||||
conn2.close();
|
||||
}
|
||||
Assert.assertEquals(0, dataSource.getActiveCount());
|
||||
Assert.assertEquals(1, dataSource.getPoolingCount());
|
||||
Assert.assertEquals(2, dataSource.getCreateCount());
|
||||
Assert.assertEquals(2, dataSource.getPoolingCount());
|
||||
Assert.assertEquals(3, dataSource.getCreateCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ public class Demo0 extends TestCase {
|
||||
private String password;
|
||||
private String driverClass;
|
||||
private int initialSize = 10;
|
||||
private int minPoolSize = 1;
|
||||
private int maxPoolSize = 2;
|
||||
private int maxActive = 2;
|
||||
private int minIdle = 1;
|
||||
private int maxIdle = 5;
|
||||
private int maxActive = 12;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
@@ -46,8 +46,8 @@ public class Demo0 extends TestCase {
|
||||
|
||||
dataSource.setInitialSize(initialSize);
|
||||
dataSource.setMaxActive(maxActive);
|
||||
dataSource.setMinIdle(minPoolSize);
|
||||
dataSource.setMaxIdle(maxPoolSize);
|
||||
dataSource.setMinIdle(minIdle);
|
||||
dataSource.setMaxIdle(maxIdle);
|
||||
dataSource.setPoolPreparedStatements(true);
|
||||
dataSource.setDriverClassName(driverClass);
|
||||
dataSource.setUrl(jdbcUrl);
|
||||
|
||||
Reference in New Issue
Block a user