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/02/24 07:06:56 UTC

[incubator-skywalking] branch scope-refactor updated: Can't guarantee the dispatchers are always existing. Put explicit comments at there to avoid confusion, since this is different with old version.

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

wusheng pushed a commit to branch scope-refactor
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/scope-refactor by this push:
     new cb0f71d  Can't guarantee the dispatchers are always existing. Put explicit comments at there to avoid confusion, since this is different with old version.
cb0f71d is described below

commit cb0f71d15a4680d7848e63fd7cd5d03aaa00a0a1
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sun Feb 24 15:06:48 2019 +0800

    Can't guarantee the dispatchers are always existing. Put explicit comments at there to avoid confusion, since this is different with old version.
---
 .../oap/server/core/analysis/DispatcherManager.java       | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/DispatcherManager.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/DispatcherManager.java
index c910c7c..f84ee9d 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/DispatcherManager.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/DispatcherManager.java
@@ -45,8 +45,17 @@ public class DispatcherManager {
             return;
         }
 
-        for (SourceDispatcher dispatcher : dispatcherMap.get(source.scope())) {
-            dispatcher.dispatch(source);
+        List<SourceDispatcher> dispatchers = dispatcherMap.get(source.scope());
+
+        /**
+         * Dispatcher is only generated by oal script analysis result.
+         * So these will/could be possible, the given source doesn't have the dispatcher,
+         * when the receiver is open, and oal script doesn't ask for analysis.
+         */
+        if (dispatchers != null) {
+            for (SourceDispatcher dispatcher : dispatchers) {
+                dispatcher.dispatch(source);
+            }
         }
     }
 
@@ -81,7 +90,7 @@ public class DispatcherManager {
                         Object source = ((Class)argument).newInstance();
 
                         if (!Source.class.isAssignableFrom(source.getClass())) {
-                            throw new UnexpectedException("unexpected type argument of class " + aClass.getName() + ", should be `org.apache.skywalking.oap.server.core.sourceScopeId.Source`. ");
+                            throw new UnexpectedException("unexpected type argument of class " + aClass.getName() + ", should be `org.apache.skywalking.oap.server.core.source.Source`. ");
                         }
 
                         Source dispatcherSource = (Source)source;