[유치수] [NOBTS] change point of removing traceid from stack.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@595 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Chisu Yu
2012-09-06 06:01:06 +00:00
parent 84b18035ab
commit 9bb9633fc3
3 changed files with 18 additions and 14 deletions
+15 -12
View File
@@ -108,22 +108,24 @@ public final class Trace {
return id;
}
public static boolean removeTraceId() {
// TraceID traceId = traceIdLocal.get();
public static boolean removeCurrentTraceIdFromStack() {
TraceIDStack stack = traceIdLocal.get();
TraceID traceId = null;
if (stack != null)
if (stack != null) {
traceId = stack.getTraceId();
} else {
// TODO : remove this log.
System.out.println("#############################################################");
System.out.println("# Something's going wrong. Stack is not exists. #");
System.out.println("#############################################################");
stack = new TraceIDStack();
traceIdLocal.set(stack);
}
if (traceId != null) {
// traceIdLocal.remove();
if (stack == null) {
traceIdLocal.set(new TraceIDStack());
}
traceIdLocal.get().clear();
stack.clear();
spanMap.remove(traceId);
return true;
}
@@ -193,7 +195,8 @@ public final class Trace {
Span span = spanMap.update(traceId, spanUpdater);
if (span.isExistsAnnotationType(Annotation.ClientRecv.getCode()) || span.isExistsAnnotationType(Annotation.ServerSend.getCode())) {
spanMap.remove(traceId);
// remove current context threadId from stack
removeCurrentTraceIdFromStack();
logSpan(span);
}
}