提交 423114b0 编写于 作者: Y youyong205

modify the insert

上级 a173f551
......@@ -92,20 +92,6 @@ public class CatFilter implements Filter {
}
}
protected String getCookie(HttpServletRequest req, String name) {
Cookie[] cookies = req.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (name.equalsIgnoreCase(cookie.getName())) {
return cookie.getValue();
}
}
}
return null;
}
@Override
public void handle(Context ctx) throws IOException, ServletException {
HttpServletRequest req = ctx.getRequest();
......@@ -117,8 +103,6 @@ public class CatFilter implements Filter {
ctx.setMode(detectMode(req));
ctx.setType(CatConstants.TYPE_URL);
Cat.setup(getCookie(req, "JSESSIONID"));
setTraceMode(req);
} else {
ctx.setType(CatConstants.TYPE_URL_FORWARD);
......@@ -171,51 +155,55 @@ public class CatFilter implements Filter {
@Override
public void handle(Context ctx) throws IOException, ServletException {
HttpServletRequest req = ctx.getRequest();
HttpServletResponse res = ctx.getResponse();
MessageProducer producer = Cat.getProducer();
int mode = ctx.getMode();
switch (mode) {
case 0:
ctx.setId(producer.createMessageId());
break;
case 1:
ctx.setRootId(req.getHeader("X-CAT-ROOT-ID"));
ctx.setParentId(req.getHeader("X-CAT-PARENT-ID"));
ctx.setId(req.getHeader("X-CAT-ID"));
break;
case 2:
ctx.setRootId(producer.createMessageId());
ctx.setParentId(ctx.getRootId());
ctx.setId(producer.createMessageId());
break;
default:
throw new RuntimeException(String.format("Internal Error: unsupported mode(%s)!", mode));
}
boolean isTraceMode = Cat.getManager().isTraceMode();
if (isTraceMode) {
HttpServletRequest req = ctx.getRequest();
HttpServletResponse res = ctx.getResponse();
MessageProducer producer = Cat.getProducer();
int mode = ctx.getMode();
switch (mode) {
case 0:
ctx.setId(producer.createMessageId());
break;
case 1:
ctx.setRootId(req.getHeader("X-CAT-ROOT-ID"));
ctx.setParentId(req.getHeader("X-CAT-PARENT-ID"));
ctx.setId(req.getHeader("X-CAT-ID"));
break;
case 2:
ctx.setRootId(producer.createMessageId());
ctx.setParentId(ctx.getRootId());
ctx.setId(producer.createMessageId());
break;
default:
throw new RuntimeException(String.format("Internal Error: unsupported mode(%s)!", mode));
}
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
tree.setMessageId(ctx.getId());
tree.setParentMessageId(ctx.getParentId());
tree.setRootMessageId(ctx.getRootId());
res.setHeader("X-CAT-SERVER", getCatServer());
switch (mode) {
case 0:
res.setHeader("X-CAT-ROOT-ID", ctx.getId());
break;
case 1:
res.setHeader("X-CAT-ROOT-ID", ctx.getRootId());
res.setHeader("X-CAT-PARENT-ID", ctx.getParentId());
res.setHeader("X-CAT-ID", ctx.getId());
break;
case 2:
res.setHeader("X-CAT-ROOT-ID", ctx.getRootId());
res.setHeader("X-CAT-PARENT-ID", ctx.getParentId());
res.setHeader("X-CAT-ID", ctx.getId());
break;
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
tree.setMessageId(ctx.getId());
tree.setParentMessageId(ctx.getParentId());
tree.setRootMessageId(ctx.getRootId());
res.setHeader("X-CAT-SERVER", getCatServer());
switch (mode) {
case 0:
res.setHeader("X-CAT-ROOT-ID", ctx.getId());
break;
case 1:
res.setHeader("X-CAT-ROOT-ID", ctx.getRootId());
res.setHeader("X-CAT-PARENT-ID", ctx.getParentId());
res.setHeader("X-CAT-ID", ctx.getId());
break;
case 2:
res.setHeader("X-CAT-ROOT-ID", ctx.getRootId());
res.setHeader("X-CAT-PARENT-ID", ctx.getParentId());
res.setHeader("X-CAT-ID", ctx.getId());
break;
}
}
ctx.handle();
......@@ -531,7 +519,6 @@ public class CatFilter implements Filter {
public String toString() {
return m_cookie.toString();
}
}
protected static interface Handler {
......
......@@ -33,7 +33,7 @@ public class AppDataService {
public static final String DELAY_AVG = "成功延时(ms)";
public void insert(AppDataCommand proto) throws DalException {
m_dao.insertData(proto);
m_dao.insert(proto);
}
public double[] queryValue(QueryEntity entity, String type) {
......
......@@ -27,11 +27,10 @@
</readset>
</readsets>
<query-defs>
<query name="insert-data" type="INSERT">
<param name="command-id" />
<query name="insert" type="INSERT" batch="true">
<statement><![CDATA[INSERT INTO <TABLE/>(<FIELDS/>)
VALUES(<VALUES/>)]]></statement>
</query>
</query>
<query name="find-data-by-minute" type="SELECT" multiple="true">
<param name="command-id" /><param name="period" />
<param name="period" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册