Add some comments.

This commit is contained in:
wusheng 2017-04-05 17:47:08 +08:00
parent d1ebaf939d
commit 58dce9ccba
2 changed files with 16 additions and 3 deletions

View File

@ -24,6 +24,13 @@ public abstract class DistributedTraceId {
return id;
}
/**
* Compare the two <code>DistributedTraceId</code> by its {@link #id},
* even these two <code>DistributedTraceId</code>s are not the same instances.
*
* @param o target <code>DistributedTraceId</code>
* @return return if they have the same {@link #id}
*/
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -100,8 +100,7 @@ public class TraceSegment {
private boolean sampled;
/**
* Create a trace segment, by given segmentId.
* This segmentId is generated by TraceSegmentRef, AKA, from tracer/agent module.
* Create a trace segment, by the given applicationCode.
*/
public TraceSegment(String applicationCode) {
this();
@ -109,7 +108,9 @@ public class TraceSegment {
}
/**
* Create a default/empty trace segment
* Create a default/empty trace segment,
* with current time as start time,
* and generate a new segment id.
*/
public TraceSegment() {
this.startTime = System.currentTimeMillis();
@ -134,6 +135,11 @@ public class TraceSegment {
}
}
/**
* Establish the line between this segment and all relative global trace ids.
*
* @param distributedTraceIds multi global trace ids. @see {@link DistributedTraceId}
*/
public void relatedGlobalTraces(List<DistributedTraceId> distributedTraceIds) {
if (distributedTraceIds == null || distributedTraceIds.size() == 0) {
return;