Refactor TracerContext.finish()

This commit is contained in:
wusheng 2017-02-19 08:50:38 +08:00
parent 04638c5177
commit 47df503bad
2 changed files with 8 additions and 3 deletions

View File

@ -93,9 +93,12 @@ public class TraceSegment {
/**
* Finish this {@link TraceSegment}.
*
* return this, for chaining
*/
public void finish(){
public TraceSegment finish(){
this.endTime = System.currentTimeMillis();
return this;
}
public String getTraceSegmentId() {

View File

@ -78,13 +78,15 @@ public final class TracerContext {
}
if (activeSpanStack.isEmpty()) {
segment.finish();
this.finish();
}
}
/**
* Finish this context, and notify all {@link TracerContextListener}s, managed by {@link ListenerManager}
*/
private void finish() {
ListenerManager.notifyFinish(segment);
ListenerManager.notifyFinish(segment.finish());
}
/**