You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/05/25 16:14:26 UTC

[skywalking] branch master updated: Determine EXTEND_SERVICE before invoker createTraceContext (#2755)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new e0b7306  Determine EXTEND_SERVICE before invoker createTraceContext (#2755)
e0b7306 is described below

commit e0b7306e5ddae91adc0faf09f505dee9401ded01
Author: zhangwei <26...@users.noreply.github.com>
AuthorDate: Sun May 26 00:14:21 2019 +0800

    Determine EXTEND_SERVICE before invoker createTraceContext (#2755)
---
 .../apache/skywalking/apm/agent/core/context/ContextManager.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java
index 2dbdb35..1537bbc 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java
@@ -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 {
                     /**