mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
增加重置数据源统计信息,同时记录统计日志
This commit is contained in:
@@ -230,6 +230,23 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
}
|
||||
}
|
||||
|
||||
public void logAndResetDataSource() {
|
||||
IdentityHashMap<Object, ObjectName> dataSources = getInstances();
|
||||
|
||||
synchronized (dataSources) {
|
||||
for (Object item : dataSources.keySet()) {
|
||||
try {
|
||||
Method method = item.getClass().getMethod("logStats");
|
||||
method.invoke(item);
|
||||
} catch (Exception e) {
|
||||
LOG.error("resetStat error", e);
|
||||
}
|
||||
}
|
||||
|
||||
resetCount.incrementAndGet();
|
||||
}
|
||||
}
|
||||
|
||||
public long getResetCount() {
|
||||
return resetCount.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user