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/incubator-skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 4a8372b Make sure module provider can't find other service in prepare
stage. (#994)
4a8372b is described below
commit 4a8372b9f5a349dac6dd7fc16eede0f30b11df33
Author: 吴晟 Wu Sheng <[email protected]>
AuthorDate: Wed Mar 28 09:53:11 2018 +0800
Make sure module provider can't find other service in prepare stage. (#994)
---
.../skywalking/apm/collector/core/module/ModuleManager.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/module/ModuleManager.java
b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/module/ModuleManager.java
index 2ece4d0..3359eff 100644
---
a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/module/ModuleManager.java
+++
b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/module/ModuleManager.java
@@ -16,7 +16,6 @@
*
*/
-
package org.apache.skywalking.apm.collector.core.module;
import java.util.Arrays;
@@ -31,6 +30,7 @@ import java.util.ServiceLoader;
* @author wu-sheng, peng-yongsheng
*/
public class ModuleManager {
+ private boolean isInPrepareStage = true;
private Map<String, Module> loadedModules = new HashMap<>();
/**
@@ -60,6 +60,8 @@ public class ModuleManager {
}
}
}
+ // Finish prepare stage
+ isInPrepareStage = false;
if (moduleList.size() > 0) {
throw new ModuleNotFoundException(moduleList.toString() + "
missing.");
@@ -76,9 +78,16 @@ public class ModuleManager {
}
public Module find(String moduleName) throws
ModuleNotFoundRuntimeException {
+ assertPreparedStage();
Module module = loadedModules.get(moduleName);
if (module != null)
return module;
throw new ModuleNotFoundRuntimeException(moduleName + " missing.");
}
+
+ private void assertPreparedStage() {
+ if (isInPrepareStage) {
+ throw new AssertionError("Still in preparing stage.");
+ }
+ }
}
--
To stop receiving notification emails like this one, please contact
[email protected].