mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for useGlobalDataSourceStat.
This commit is contained in:
@@ -85,4 +85,6 @@ public interface DruidDataSourceMBean extends DruidAbstractDataSourceMBean {
|
||||
int fill() throws SQLException;
|
||||
|
||||
int fill(int toCount) throws SQLException;
|
||||
|
||||
boolean isUseGlobalDataSourceStat();
|
||||
}
|
||||
|
||||
@@ -145,9 +145,21 @@ public final class DruidStatManagerFacade {
|
||||
Set<Object> dataSources = getDruidDataSourceInstances();
|
||||
|
||||
if (dataSourceId == null) {
|
||||
JdbcDataSourceStat globalStat = JdbcDataSourceStat.getGlobal();
|
||||
|
||||
List<Map<String, Object>> sqlList = new ArrayList<Map<String, Object>>();
|
||||
|
||||
DruidDataSource globalStatDataSource = null;
|
||||
for (Object datasource : dataSources) {
|
||||
if (datasource instanceof DruidDataSource) {
|
||||
if (((DruidDataSource) datasource).getDataSourceStat() == globalStat) {
|
||||
if (globalStatDataSource == null) {
|
||||
globalStatDataSource = (DruidDataSource) datasource;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
sqlList.addAll(getSqlStatDataList(datasource));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user