1. 修复在Dubbo超时重试的时候会造成数据出错的问题

This commit is contained in:
ascrutae 2016-01-27 17:28:24 +08:00
parent be44363c08
commit 77f3e2f4a9
1 changed files with 12 additions and 1 deletions

View File

@ -30,7 +30,18 @@ public class SWDubboEnhanceFilter implements Filter {
//追加参数
if (!BugFixAcitve.isActive) {
context.setAttachment("contextData", contextDataStr);
// context.setAttachment("contextData", contextDataStr);
// context的setAttachment方法在重试机制的时候并不会覆盖原有的Attachment
// 参见Dubbo源代码com.alibaba.dubbo.rpc.RpcInvocation
// public void setAttachmentIfAbsent(String key, String value) {
// if (attachments == null) {
// attachments = new HashMap<String, String>();
// }
// if (! attachments.containsKey(key)) {
// attachments.put(key, value);
// }
// }
invocation.getAttachments().put("contextData", contextDataStr);
} else {
fix283SendNoAttachmentIssue(invocation, contextDataStr);
}