mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
@@ -58,7 +58,9 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
private long executeErrorLastTime;
|
||||
|
||||
private final AtomicLong updateCount = new AtomicLong();
|
||||
private final AtomicLong updateCountMax = new AtomicLong();
|
||||
private final AtomicLong fetchRowCount = new AtomicLong();
|
||||
private final AtomicLong fetchRowCountMax = new AtomicLong();
|
||||
|
||||
private final AtomicLong inTransactionCount = new AtomicLong();
|
||||
|
||||
@@ -199,7 +201,9 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
executeErrorLastTime = 0;
|
||||
|
||||
updateCount.set(0);
|
||||
updateCountMax.set(0);
|
||||
fetchRowCount.set(0);
|
||||
fetchRowCountMax.set(0);
|
||||
|
||||
histogram.reset();
|
||||
this.lastSlowParameters = null;
|
||||
@@ -222,6 +226,13 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
public void addUpdateCount(int delta) {
|
||||
if (delta > 0) {
|
||||
this.updateCount.addAndGet(delta);
|
||||
}
|
||||
for (;;) {
|
||||
long max = updateCountMax.get();
|
||||
if (delta <= max) break;
|
||||
if (updateCountMax.compareAndSet(max, delta)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateCountHistogram.record(delta);
|
||||
@@ -230,11 +241,18 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
public long getUpdateCount() {
|
||||
return updateCount.get();
|
||||
}
|
||||
public long getUpdateCountMax() {
|
||||
return updateCountMax.get();
|
||||
}
|
||||
|
||||
public long getFetchRowCount() {
|
||||
return fetchRowCount.get();
|
||||
}
|
||||
|
||||
public long getFetchRowCountMax() {
|
||||
return fetchRowCountMax.get();
|
||||
|
||||
}
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -274,7 +292,14 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
}
|
||||
|
||||
public void addFetchRowCount(long delta) {
|
||||
this.fetchRowCount.addAndGet(delta);
|
||||
this.fetchRowCount.addAndGet(delta);
|
||||
for (;;) {
|
||||
long max = fetchRowCountMax.get();
|
||||
if (delta <= max) break;
|
||||
if (fetchRowCountMax.compareAndSet(max, delta)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.fetchRowCountHistogram.record(delta);
|
||||
|
||||
}
|
||||
@@ -448,6 +473,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
|
||||
new ArrayType<Long>(SimpleType.LONG, true), //
|
||||
new ArrayType<Long>(SimpleType.LONG, true), //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
|
||||
};
|
||||
|
||||
@@ -496,7 +523,9 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
|
||||
// 30
|
||||
"EffectedRowCountHistogram", //
|
||||
"ExecuteAndResultHoldTimeHistogram"
|
||||
"ExecuteAndResultHoldTimeHistogram", //
|
||||
"EffectedRowCountMax", //
|
||||
"FetchRowCountMax"
|
||||
|
||||
//
|
||||
};
|
||||
@@ -526,7 +555,7 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
map.put("MaxTimespan", getExecuteMillisMax());
|
||||
map.put("LastError", JMXUtils.getErrorCompositeData(this.getExecuteErrorLast()));
|
||||
map.put("EffectedRowCount", getUpdateCount());
|
||||
|
||||
|
||||
// 10 - 14
|
||||
map.put("FetchRowCount", getFetchRowCount());
|
||||
map.put("MaxTimespanOccurTime", getExecuteNanoSpanMaxOccurTime());
|
||||
@@ -565,6 +594,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
|
||||
map.put("EffectedRowCountHistogram", this.getUpdateCountHistogram().toArray()); // 30
|
||||
map.put("ExecuteAndResultHoldTimeHistogram", this.getExecuteAndResultHoldTimeHistogram().toArray()); // 30
|
||||
map.put("EffectedRowCountMax", getUpdateCountMax());
|
||||
map.put("FetchRowCountMax", getFetchRowCountMax());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user