增强监控

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@339 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-07-01 02:21:46 +00:00
parent c7c918f3f6
commit 66427ef248
3 changed files with 30 additions and 4 deletions
@@ -162,4 +162,30 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
}
return aliveNanoSpan / (1000 * 1000);
}
public long getConnectionConnectAliveMillisMax() {
long nowNano = System.nanoTime();
long max = this.getConnectionStat().getAliveNanoMax();
for (JdbcConnectionStat.Entry connection : connections.values()) {
long connectionAliveNano = nowNano - connection.getEstablishNano();
if (connectionAliveNano > max) {
max = connectionAliveNano;
}
}
return max / (1000 * 1000);
}
public long getConnectionConnectAliveMillisMin() {
long nowNano = System.nanoTime();
long min = this.getConnectionStat().getAliveNanoMin();
for (JdbcConnectionStat.Entry connection : connections.values()) {
long connectionAliveNano = nowNano - connection.getEstablishNano();
if (connectionAliveNano < min || min == 0) {
min = connectionAliveNano;
}
}
return min / (1000 * 1000);
}
}