improve wall filter

This commit is contained in:
wenshao
2013-04-05 12:49:25 +08:00
parent d268227242
commit 9ea3434bc4
12 changed files with 324 additions and 17 deletions
@@ -32,6 +32,7 @@ public class WallTableStat {
private volatile long createCount;
private volatile long alterCount;
private volatile long dropCount;
private volatile long replaceCount;
final static AtomicLongFieldUpdater<WallTableStat> selectCountUpdater = AtomicLongFieldUpdater.newUpdater(WallTableStat.class,
"selectCount");
@@ -51,6 +52,8 @@ public class WallTableStat {
"alterCount");
final static AtomicLongFieldUpdater<WallTableStat> dropCountUpdater = AtomicLongFieldUpdater.newUpdater(WallTableStat.class,
"dropCount");
final static AtomicLongFieldUpdater<WallTableStat> replaceCountUpdater = AtomicLongFieldUpdater.newUpdater(WallTableStat.class,
"replaceCount");
public WallTableStat(){
@@ -91,6 +94,10 @@ public class WallTableStat {
public long getDropCount() {
return dropCount;
}
public long getReplaceCount() {
return replaceCount;
}
public void addSqlTableStat(WallSqlTableStat stat) {
{
@@ -147,6 +154,12 @@ public class WallTableStat {
dropCountUpdater.addAndGet(this, val);
}
}
{
long val = stat.getReplaceCount();
if (val > 0) {
replaceCountUpdater.addAndGet(this, val);
}
}
}
public String toString() {
@@ -155,7 +168,7 @@ public class WallTableStat {
return JSONUtils.toJSONString(map);
}
public Map<String, Object> toMap() {
Map<String, Object> map = new LinkedHashMap<String, Object>();
return toMap(map);
@@ -186,6 +199,9 @@ public class WallTableStat {
if (truncateCount > 0) {
map.put("truncateCount", truncateCount);
}
if (replaceCount > 0) {
map.put("replaceCount", replaceCount);
}
return map;
}
}