mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sql-wall
This commit is contained in:
@@ -25,15 +25,19 @@ import java.util.concurrent.atomic.AtomicLongFieldUpdater;
|
||||
public class WallSqlStat {
|
||||
|
||||
private volatile long executeCount;
|
||||
private volatile long executeErrorCount;
|
||||
private volatile long fetchRowCount;
|
||||
private volatile long updateCount;
|
||||
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> executeCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"executeCount");
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> fetchRowCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"fetchRowCount");
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> updateCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"updateCount");
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> executeCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"executeCount");
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> executeErrorCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"executeErrorCount");
|
||||
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> fetchRowCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"fetchRowCount");
|
||||
final static AtomicLongFieldUpdater<WallSqlStat> updateCountUpdater = AtomicLongFieldUpdater.newUpdater(WallSqlStat.class,
|
||||
"updateCount");
|
||||
private final Map<String, WallSqlTableStat> tableStats;
|
||||
|
||||
private final List<Violation> violations;
|
||||
@@ -79,12 +83,16 @@ public class WallSqlStat {
|
||||
return executeCountUpdater.incrementAndGet(this);
|
||||
}
|
||||
|
||||
public long incrementAndGetExecuteErrorCount() {
|
||||
return executeErrorCountUpdater.incrementAndGet(this);
|
||||
}
|
||||
|
||||
public long getExecuteCount() {
|
||||
return executeCount;
|
||||
}
|
||||
|
||||
public long incrementAndGetFetchRowCount() {
|
||||
return fetchRowCountUpdater.incrementAndGet(this);
|
||||
public long getExecuteErrorCount() {
|
||||
return executeErrorCount;
|
||||
}
|
||||
|
||||
public long addAndFetchRowCount(long delta) {
|
||||
@@ -123,6 +131,7 @@ public class WallSqlStat {
|
||||
final WallSqlStatValue statValue = new WallSqlStatValue();
|
||||
|
||||
statValue.setExecuteCount(get(this, executeCountUpdater, reset));
|
||||
statValue.setExecuteErrorCount(get(this, executeErrorCountUpdater, reset));
|
||||
statValue.setFetchRowCount(get(this, fetchRowCountUpdater, reset));
|
||||
statValue.setUpdateCount(get(this, updateCountUpdater, reset));
|
||||
statValue.setSyntaxError(this.syntaxError);
|
||||
|
||||
Reference in New Issue
Block a user