diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java index ea5af0fe6..ed1693512 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java @@ -21,6 +21,7 @@ public enum ServiceManager { public void boot() { bootedServices = loadAllServices(); + startup(); } private Map loadAllServices() { @@ -28,16 +29,21 @@ public enum ServiceManager { Iterator serviceIterator = load().iterator(); while (serviceIterator.hasNext()) { BootService bootService = serviceIterator.next(); - try { - bootService.bootUp(); - bootedServices.put(bootService.getClass(), bootService); - } catch (Throwable e) { - logger.error(e, "ServiceManager try to start [{}] fail.", bootService.getClass().getName()); - } + bootedServices.put(bootService.getClass(), bootService); } return bootedServices; } + private void startup() { + for (BootService service : bootedServices.values()) { + try { + service.bootUp(); + } catch (Throwable e) { + logger.error(e, "ServiceManager try to start [{}] fail.", service.getClass().getName()); + } + } + } + /** * Find a {@link BootService} implementation, which is already started. *