mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor activeConnections record
This commit is contained in:
@@ -134,7 +134,19 @@ public final class DruidStatManagerFacade {
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getSqlStatDataList(Integer dataSourceId) {
|
||||
for (Object datasource : getDruidDataSourceInstances()) {
|
||||
Set<Object> dataSources = getDruidDataSourceInstances();
|
||||
|
||||
if (dataSourceId == null) {
|
||||
List<Map<String, Object>> sqlList = new ArrayList<Map<String, Object>>();
|
||||
|
||||
for (Object datasource : dataSources) {
|
||||
sqlList.addAll(getSqlStatDataList(datasource));
|
||||
}
|
||||
|
||||
return sqlList;
|
||||
}
|
||||
|
||||
for (Object datasource : dataSources) {
|
||||
if (dataSourceId != null && dataSourceId.intValue() != System.identityHashCode(datasource)) {
|
||||
continue;
|
||||
}
|
||||
@@ -147,7 +159,8 @@ public final class DruidStatManagerFacade {
|
||||
|
||||
public List<Map<String, Object>> getSqlStatDataList(Object datasource) {
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
for (Object sqlStat : DruidDataSourceUtils.getSqlStatMap(datasource).values()) {
|
||||
Map<?, ?> sqlStatMap = DruidDataSourceUtils.getSqlStatMap(datasource);
|
||||
for (Object sqlStat : sqlStatMap.values()) {
|
||||
Map<String, Object> data = JdbcSqlStatUtils.getData(sqlStat);
|
||||
|
||||
long executeCount = (Long) data.get("ExecuteCount");
|
||||
|
||||
Reference in New Issue
Block a user