Merge pull request #794 from carlvine500/master
bugfix:no data collected after application started
This commit is contained in:
commit
75be8c879f
|
|
@ -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 @@ public enum ServiceManager {
|
|||
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 enum ServiceManager {
|
|||
}
|
||||
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -44,13 +44,15 @@ public class CollectorDiscoveryService implements BootService {
|
|||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue