Determine EXTEND_SERVICE before invoker createTraceContext (#2755)

This commit is contained in:
zhangwei 2019-05-26 00:14:21 +08:00 committed by 吴晟 Wu Sheng
parent e0827e30ea
commit e0b7306e5d
1 changed files with 3 additions and 3 deletions

View File

@ -44,9 +44,6 @@ public class ContextManager implements BootService {
private static AbstractTracerContext getOrCreate(String operationName, boolean forceSampling) {
AbstractTracerContext context = CONTEXT.get();
if (EXTEND_SERVICE == null) {
EXTEND_SERVICE = ServiceManager.INSTANCE.findService(ContextManagerExtendService.class);
}
if (context == null) {
if (StringUtil.isEmpty(operationName)) {
if (logger.isDebugEnable()) {
@ -57,6 +54,9 @@ public class ContextManager implements BootService {
if (RemoteDownstreamConfig.Agent.SERVICE_ID != DictionaryUtil.nullValue()
&& RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID != DictionaryUtil.nullValue()
) {
if (EXTEND_SERVICE == null) {
EXTEND_SERVICE = ServiceManager.INSTANCE.findService(ContextManagerExtendService.class);
}
context = EXTEND_SERVICE.createTraceContext(operationName, forceSampling);
} else {
/**