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:
@@ -1515,6 +1515,8 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
return;
|
||||
}
|
||||
closedPreparedStatementCount.incrementAndGet();
|
||||
decrementCachedPreparedStatementCount();
|
||||
incrementCachedPreparedStatementDeleteCount();
|
||||
|
||||
JdbcUtils.close(stmtHolder.getStatement());
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -159,8 +159,6 @@ public class PreparedStatementPool {
|
||||
OracleUtils.exitImplicitCacheToClose(holder.getStatement());
|
||||
}
|
||||
dataSource.closePreapredStatement(holder);
|
||||
dataSource.decrementCachedPreparedStatementCount();
|
||||
dataSource.incrementCachedPreparedStatementDeleteCount();
|
||||
}
|
||||
|
||||
public Map<PreparedStatementKey, PreparedStatementHolder> getMap() {
|
||||
|
||||
Reference in New Issue
Block a user