mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
增强监控
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@339 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user