增加重置数据源统计信息,同时记录统计日志

This commit is contained in:
zhaoye
2015-07-08 16:19:03 +08:00
parent 8954735ada
commit 35ff7bafad
7 changed files with 53 additions and 4 deletions
@@ -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();
}