You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2018/04/24 04:04:36 UTC
[incubator-skywalking] branch refactor/agent updated: Remove
duplicate plugin load.
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch refactor/agent
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/refactor/agent by this push:
new f3501b9 Remove duplicate plugin load.
f3501b9 is described below
commit f3501b9822840c4a8d06fd2e18a1fb33437bc72d
Author: wusheng <wu...@foxmail.com>
AuthorDate: Tue Apr 24 12:04:27 2018 +0800
Remove duplicate plugin load.
---
.../skywalking/apm/agent/core/boot/ServiceManager.java | 14 +++-----------
.../skywalking/apm/agent/core/boot/ServiceManagerTest.java | 2 +-
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/ServiceManager.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/ServiceManager.java
index 3bf8792..638bcc6 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/ServiceManager.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/ServiceManager.java
@@ -63,7 +63,6 @@ public enum ServiceManager {
Map<Class, BootService> bootedServices = new LinkedHashMap<Class, BootService>();
List<BootService> allServices = new LinkedList<BootService>();
load(allServices);
- loadFromPlugins(allServices);
Iterator<BootService> serviceIterator = allServices.iterator();
while (serviceIterator.hasNext()) {
BootService bootService = serviceIterator.next();
@@ -82,7 +81,7 @@ public enum ServiceManager {
if (!bootedServices.containsKey(bootServiceClass)) {
bootedServices.put(bootServiceClass, bootService);
} else {
- throw new ServiceConflictException("Duplicate service define for :" + bootServiceClass.getClass());
+ throw new ServiceConflictException("Duplicate service define for :" + bootServiceClass);
}
} else {
Class<? extends BootService> targetService = overrideImplementor.value();
@@ -91,8 +90,8 @@ public enum ServiceManager {
if (presentDefault) {
bootedServices.put(targetService, bootService);
} else {
- throw new ServiceConflictException("Service " + bootServiceClass.getClass() + " overrides conflict, " +
- "exist more than one service want to override :" + targetService.getClass());
+ throw new ServiceConflictException("Service " + bootServiceClass + " overrides conflict, " +
+ "exist more than one service want to override :" + targetService);
}
} else {
bootedServices.put(targetService, bootService);
@@ -146,13 +145,6 @@ public enum ServiceManager {
}
void load(List<BootService> allServices) {
- Iterator<BootService> iterator = ServiceLoader.load(BootService.class).iterator();
- while (iterator.hasNext()) {
- allServices.add(iterator.next());
- }
- }
-
- void loadFromPlugins(List<BootService> allServices) {
Iterator<BootService> iterator = ServiceLoader.load(BootService.class, AgentClassLoader.getDefault()).iterator();
while (iterator.hasNext()) {
allServices.add(iterator.next());
diff --git a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java
index 7f35881..912f2d9 100644
--- a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java
+++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java
@@ -57,7 +57,7 @@ public class ServiceManagerTest {
public void testServiceDependencies() throws Exception {
HashMap<Class, BootService> registryService = getFieldValue(ServiceManager.INSTANCE, "bootedServices");
- assertThat(registryService.size(), is(7));
+ assertThat(registryService.size(), is(8));
assertTraceSegmentServiceClient(ServiceManager.INSTANCE.findService(TraceSegmentServiceClient.class));
assertContextManager(ServiceManager.INSTANCE.findService(ContextManager.class));
--
To stop receiving notification emails like this one, please contact
wusheng@apache.org.