mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add testcase & bug fixed
This commit is contained in:
@@ -218,8 +218,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
return;
|
||||
}
|
||||
|
||||
this.poolPreparedStatements = value;
|
||||
|
||||
if (!inited) {
|
||||
this.poolPreparedStatements = value;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -227,22 +228,22 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
LOG.info("set poolPreparedStatements " + this.poolPreparedStatements + " -> " + value);
|
||||
}
|
||||
|
||||
lock.lock();
|
||||
try {
|
||||
if (this.poolPreparedStatements && (!value)) {
|
||||
if (!value) {
|
||||
lock.lock();
|
||||
try {
|
||||
|
||||
for (int i = 0; i < poolingCount; ++i) {
|
||||
DruidConnectionHolder connection = connections[i];
|
||||
|
||||
for (PreparedStatementHolder holder : connection.getStatementPool().getMap().values()) {
|
||||
closePreapredStatement(holder);
|
||||
decrementCachedPreparedStatementCount();
|
||||
}
|
||||
|
||||
connection.getStatementPool().getMap().clear();
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1804,6 +1805,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
return this.getDataSourceStat().getSqlStat(sqlId);
|
||||
}
|
||||
|
||||
public JdbcSqlStat getSqlStat(long sqlId) {
|
||||
return this.getDataSourceStat().getSqlStat(sqlId);
|
||||
}
|
||||
|
||||
public Map<String, JdbcSqlStat> getSqlStatMap() {
|
||||
return this.getDataSourceStat().getSqlStatMap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user