mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for useGloalDataSourceStat
This commit is contained in:
@@ -471,8 +471,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
initExceptionSorter();
|
||||
initValidConnectionChecker();
|
||||
|
||||
if (useGloalDataSourceStat) {
|
||||
if (isUseGloalDataSourceStat()) {
|
||||
dataSourceStat = JdbcDataSourceStat.getGlobal();
|
||||
if (dataSourceStat.getDbType() == null) {
|
||||
dataSourceStat.setDbType(this.getDbType());
|
||||
}
|
||||
if (dataSourceStat == null) {
|
||||
dataSourceStat = new JdbcDataSourceStat("Global", "Global", this.dbType);
|
||||
JdbcDataSourceStat.setGlobal(dataSourceStat);
|
||||
|
||||
@@ -113,6 +113,14 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
|
||||
|
||||
sqlStatMap = new LRUCache<String, JdbcSqlStat>(maxSize, 16, 0.75f, false);
|
||||
}
|
||||
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
blobOpenCount.set(0);
|
||||
@@ -266,6 +274,7 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
|
||||
if (sqlStat == null) {
|
||||
sqlStat = new JdbcSqlStat(sql);
|
||||
sqlStat.setDbType(this.dbType);
|
||||
sqlStat.setName(this.name);
|
||||
sqlStatMap.put(sql, sqlStat);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user