mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
StatFilter mergeSql support tddl
This commit is contained in:
@@ -130,6 +130,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
private JdbcDataSourceStat dataSourceStat;
|
||||
|
||||
private boolean useGloalDataSourceStat = false;
|
||||
|
||||
public DruidDataSource(){
|
||||
this(false);
|
||||
}
|
||||
@@ -149,6 +151,22 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
this.setValidationQuery(property);
|
||||
}
|
||||
}
|
||||
{
|
||||
String property = System.getProperty("druid.useGloalDataSourceStat");
|
||||
if ("true".equals(property)) {
|
||||
this.setUseGloalDataSourceStat(true);
|
||||
} else if ("false".equals(property)) {
|
||||
this.setUseGloalDataSourceStat(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isUseGloalDataSourceStat() {
|
||||
return useGloalDataSourceStat;
|
||||
}
|
||||
|
||||
public void setUseGloalDataSourceStat(boolean useGloalDataSourceStat) {
|
||||
this.useGloalDataSourceStat = useGloalDataSourceStat;
|
||||
}
|
||||
|
||||
public String getInitStackTrace() {
|
||||
@@ -435,7 +453,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
|
||||
dataSourceStat = new JdbcDataSourceStat(this.name, this.jdbcUrl, this.dbType);
|
||||
if (useGloalDataSourceStat) {
|
||||
dataSourceStat = JdbcDataSourceStat.getGlobal();
|
||||
} else {
|
||||
dataSourceStat = new JdbcDataSourceStat(this.name, this.jdbcUrl, this.dbType);
|
||||
}
|
||||
|
||||
connections = new DruidConnectionHolder[maxActive];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user