refactor clob wrap

This commit is contained in:
wenshao
2012-08-23 07:27:41 +08:00
parent b9c2010eab
commit ada54377f1
2 changed files with 64 additions and 31 deletions
@@ -68,6 +68,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
private boolean removed = false;
private final AtomicLong clobOpenCount = new AtomicLong();
private final Histogram histogram = new Histogram(new long[] { //
//
1, 10, 100, 1000, 10 * 1000, //
@@ -213,6 +215,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
fetchRowCountHistogram.reset();
updateCountHistogram.reset();
executeAndResultHoldTimeHistogram.reset();
clobOpenCount.set(0);
}
public long getConcurrentMax() {
@@ -226,7 +230,7 @@ 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;
@@ -241,7 +245,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
public long getUpdateCount() {
return updateCount.get();
}
public long getUpdateCountMax() {
public long getUpdateCountMax() {
return updateCountMax.get();
}
@@ -249,10 +254,18 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
return fetchRowCount.get();
}
public long getFetchRowCountMax() {
public long getFetchRowCountMax() {
return fetchRowCountMax.get();
}
public long getClobOpenCount() {
return clobOpenCount.get();
}
public void incrementClobOpenCount() {
clobOpenCount.incrementAndGet();
}
public long getId() {
return id;
}
@@ -292,7 +305,7 @@ 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;
@@ -361,7 +374,7 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
public void addExecuteTime(StatementExecuteType executeType, boolean firstResultSet, long nanoSpan) {
addExecuteTime(nanoSpan);
if (StatementExecuteType.ExecuteQuery != executeType && !firstResultSet) {
executeAndResultHoldTimeHistogram.record((nanoSpan) / 1000 / 1000);
}
@@ -516,16 +529,16 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
// 25 - 29
"Histogram", //
"LastSlowParameters", //
"ResultSetHoldTime", //
"ExecuteAndResultSetHoldTime", //
"LastSlowParameters", //
"ResultSetHoldTime", //
"ExecuteAndResultSetHoldTime", //
"FetchRowCountHistogram", //
// 30
"EffectedRowCountHistogram", //
"EffectedRowCountHistogram", //
"ExecuteAndResultHoldTimeHistogram", //
"EffectedRowCountMax", //
"FetchRowCountMax"
"FetchRowCountMax"
//
};
@@ -555,7 +568,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());