Merge branch 'master' into 5.0.0-alpha-doc

This commit is contained in:
吴晟 Wu Sheng 2018-03-05 18:56:30 +08:00 committed by GitHub
commit 12a486fb42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 16 deletions

View File

@ -248,21 +248,7 @@ public class TracingContext implements AbstractTracerContext {
AbstractSpan entrySpan;
final AbstractSpan parentSpan = peek();
final int parentSpanId = parentSpan == null ? -1 : parentSpan.getSpanId();
if (parentSpan == null) {
entrySpan = (AbstractTracingSpan)DictionaryManager.findOperationNameCodeSection()
.findOnly(segment.getApplicationId(), operationName)
.doInCondition(new PossibleFound.FoundAndObtain() {
@Override public Object doProcess(int operationId) {
return new EntrySpan(spanIdGenerator++, parentSpanId, operationId);
}
}, new PossibleFound.NotFoundAndObtain() {
@Override public Object doProcess() {
return new EntrySpan(spanIdGenerator++, parentSpanId, operationName);
}
});
entrySpan.start();
return push(entrySpan);
} else if (parentSpan.isEntry()) {
if (parentSpan != null && parentSpan.isEntry()) {
entrySpan = (AbstractTracingSpan)DictionaryManager.findOperationNameCodeSection()
.findOnly(segment.getApplicationId(), operationName)
.doInCondition(new PossibleFound.FoundAndObtain() {
@ -276,7 +262,19 @@ public class TracingContext implements AbstractTracerContext {
});
return entrySpan.start();
} else {
throw new IllegalStateException("The Entry Span can't be the child of Non-Entry Span");
entrySpan = (AbstractTracingSpan)DictionaryManager.findOperationNameCodeSection()
.findOnly(segment.getApplicationId(), operationName)
.doInCondition(new PossibleFound.FoundAndObtain() {
@Override public Object doProcess(int operationId) {
return new EntrySpan(spanIdGenerator++, parentSpanId, operationId);
}
}, new PossibleFound.NotFoundAndObtain() {
@Override public Object doProcess() {
return new EntrySpan(spanIdGenerator++, parentSpanId, operationName);
}
});
entrySpan.start();
return push(entrySpan);
}
}