wu-sheng closed pull request #794: bugfix:no data collected after application
started
URL: https://github.com/apache/incubator-skywalking/pull/794
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 e1ca40ab0..33d189958 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
@@ -19,8 +19,9 @@
package org.apache.skywalking.apm.agent.core.boot;
-import java.util.HashMap;
+import java.util.Collections;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.ServiceLoader;
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
@@ -36,7 +37,7 @@
INSTANCE;
private static final ILog logger =
LogManager.getLogger(ServiceManager.class);
- private Map<Class, BootService> bootedServices = new HashMap<Class,
BootService>();
+ private Map<Class, BootService> bootedServices = Collections.emptyMap();
public void boot() {
bootedServices = loadAllServices();
@@ -57,7 +58,7 @@ public void shutdown() {
}
private Map<Class, BootService> loadAllServices() {
- HashMap<Class, BootService> bootedServices = new HashMap<Class,
BootService>();
+ Map<Class, BootService> bootedServices = new LinkedHashMap<Class,
BootService>();
Iterator<BootService> serviceIterator = load().iterator();
while (serviceIterator.hasNext()) {
BootService bootService = serviceIterator.next();
diff --git
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
index f7910f71d..b5d4f442e 100644
---
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
+++
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
@@ -44,13 +44,15 @@ public void beforeBoot() throws Throwable {
@Override
public void boot() throws Throwable {
+ DiscoveryRestServiceClient discoveryRestServiceClient = new
DiscoveryRestServiceClient();
+ discoveryRestServiceClient.run();
future = Executors.newSingleThreadScheduledExecutor(new
DefaultNamedThreadFactory("CollectorDiscoveryService"))
- .scheduleAtFixedRate(new RunnableWithExceptionProtection(new
DiscoveryRestServiceClient(),
+ .scheduleAtFixedRate(new
RunnableWithExceptionProtection(discoveryRestServiceClient,
new
RunnableWithExceptionProtection.CallbackWhenException() {
@Override public void handle(Throwable t) {
logger.error("unexpected exception.", t);
}
- }), 0,
+ }), Config.Collector.DISCOVERY_CHECK_INTERVAL,
Config.Collector.DISCOVERY_CHECK_INTERVAL, TimeUnit.SECONDS);
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services