SqlStat添加DbType字段

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@182 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-05-21 12:12:59 +00:00
parent 83606183ef
commit ce68bc1077
2 changed files with 16 additions and 3 deletions
@@ -112,6 +112,8 @@ public class SQLParser {
private int errorEndPos = -1;
protected void setErrorEndPos(int errPos) {
if (errPos > errorEndPos) errorEndPos = errPos;
if (errPos > errorEndPos) {
errorEndPos = errPos;
}
}
}
@@ -50,6 +50,7 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
private final AtomicLong concurrentMax = new AtomicLong();
private String name;
private String file;
private String dbType;
private long executeNanoSpanMaxOccurTime;
@@ -60,6 +61,14 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
private final AtomicLong updateCount = new AtomicLong();
private final AtomicLong fetchRowCount = new AtomicLong();
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public String getDataSource() {
return dataSource;
}
@@ -310,11 +319,11 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
OpenType<?>[] indexTypes = new OpenType<?>[] { SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.DATE, SimpleType.LONG, JMXUtils.getThrowableCompositeType(), SimpleType.LONG, SimpleType.LONG, SimpleType.DATE,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.DATE };
SimpleType.STRING, SimpleType.DATE, SimpleType.STRING };
String[] indexNames = { "ID", "DataSource", "SQL", "ExecuteCount", "ErrorCount", "TotalTime", "LastTime", "MaxTimespan", "LastError",
"EffectedRowCount", "FetchRowCount", "MaxTimespanOccurTime", "BatchSizeMax", "BatchSizeTotal", "ConcurrentMax", "RunningCount", "Name", "File",
"LastErrorMessage", "LastErrorClass", "LastErrorStackTrace", "LastErrorTime" };
"LastErrorMessage", "LastErrorClass", "LastErrorStackTrace", "LastErrorTime", "DbType" };
String[] indexDescriptions = indexNames;
COMPOSITE_TYPE = new CompositeType("SqlStatistic", "Sql Statistic", indexNames, indexDescriptions, indexTypes);
@@ -366,6 +375,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
map.put("LastErrorTime", null);
}
map.put("DbType", dbType);
return new CompositeDataSupport(getCompositeType(), map);
}