1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

optimize code

This commit is contained in:
陈健斌 2020-04-23 13:32:24 +08:00
parent 8fa763f7d6
commit fa588d65c8

View File

@ -47,8 +47,6 @@ public class SeataHandlerInterceptor implements HandlerInterceptor {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) { Object handler) {
Object xidStatus = request.getAttribute(BIND_XID);
if (null == xidStatus || !(boolean)xidStatus) {
String xid = RootContext.getXID(); String xid = RootContext.getXID();
String rpcXid = request.getHeader(RootContext.KEY_XID); String rpcXid = request.getHeader(RootContext.KEY_XID);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -62,7 +60,6 @@ public class SeataHandlerInterceptor implements HandlerInterceptor {
log.debug("bind {} to RootContext", rpcXid); log.debug("bind {} to RootContext", rpcXid);
} }
} }
}
return true; return true;
} }
@ -86,7 +83,6 @@ public class SeataHandlerInterceptor implements HandlerInterceptor {
log.warn("xid in change during RPC from {} to {}", rpcXid, unbindXid); log.warn("xid in change during RPC from {} to {}", rpcXid, unbindXid);
if (unbindXid != null) { if (unbindXid != null) {
RootContext.bind(unbindXid); RootContext.bind(unbindXid);
request.setAttribute(UNBIND_XID, true);
log.warn("bind {} back to RootContext", unbindXid); log.warn("bind {} back to RootContext", unbindXid);
} }
} }