improve WallFilter

This commit is contained in:
wenshao
2013-03-17 08:41:41 +08:00
parent eec1ab34e5
commit c6182111d9
5 changed files with 237 additions and 62 deletions
@@ -0,0 +1,34 @@
package com.alibaba.druid.wall;
public class WallContext {
private final static ThreadLocal<WallContext> contextLocal = new ThreadLocal<WallContext>();
private WallSqlStat sqlState;
public static WallContext createIfNotExists() {
WallContext context = contextLocal.get();
if (context == null) {
context = new WallContext();
contextLocal.set(context);
}
return context;
}
public static WallContext current() {
return contextLocal.get();
}
public static void clearContext() {
contextLocal.remove();
}
public WallSqlStat getSqlState() {
return sqlState;
}
public void setSqlState(WallSqlStat sqlState) {
this.sqlState = sqlState;
}
}