Loading skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java +16 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,9 @@ package com.a.eye.skywalking.api.boot; import com.a.eye.skywalking.logging.ILog; import com.a.eye.skywalking.logging.LogManager; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.ServiceLoader; /** Loading @@ -16,15 +18,18 @@ public enum ServiceStarter { private static ILog logger = LogManager.getLogger(StatusBootService.class); private volatile boolean isStarted = false; private Map<Class, BootService> bootedServices; public void boot() { while (!isStarted) { if (!isStarted) { try { bootedServices = new HashMap<>(); Iterator<BootService> serviceIterator = load().iterator(); while (serviceIterator.hasNext()) { BootService bootService = serviceIterator.next(); try { bootService.bootUp(); bootedServices.put(bootService.getClass(), bootService); } catch (Exception e) { logger.error(e, "ServiceStarter try to start [{}] fail.", bootService.getClass().getName()); } Loading @@ -35,6 +40,16 @@ public enum ServiceStarter { } } /** * Find a {@link BootService} implementation, which is already started. * @param serviceClass class name. * @param <T> {@link BootService} implementation class. * @return {@link BootService} instance */ public <T extends BootService> T findService(Class<T> serviceClass){ return (T)bootedServices.get(serviceClass); } ServiceLoader<BootService> load() { return ServiceLoader.load(BootService.class); } Loading skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/client/CollectorClientService.java 0 → 100644 +13 −0 Original line number Diff line number Diff line package com.a.eye.skywalking.api.client; import com.a.eye.skywalking.api.boot.BootService; /** * @author wusheng */ public class CollectorClientService implements BootService { @Override public void bootUp() { } } skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-logback-1.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/logback/v1/x/LogbackPatternConverterActivation.java +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class LogbackPatternConverterActivation extends ClassInstanceMethodsEnhan @Override public String getMethodsInterceptor() { return "com.a.eye.skywalking.toolkit.log.logback.v1.x.PrintTraceIdInterceptor"; return "com.a.eye.skywalking.toolkit.activation.log.logback.v1.x.PrintTraceIdInterceptor"; } }}; } Loading Loading
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java +16 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,9 @@ package com.a.eye.skywalking.api.boot; import com.a.eye.skywalking.logging.ILog; import com.a.eye.skywalking.logging.LogManager; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.ServiceLoader; /** Loading @@ -16,15 +18,18 @@ public enum ServiceStarter { private static ILog logger = LogManager.getLogger(StatusBootService.class); private volatile boolean isStarted = false; private Map<Class, BootService> bootedServices; public void boot() { while (!isStarted) { if (!isStarted) { try { bootedServices = new HashMap<>(); Iterator<BootService> serviceIterator = load().iterator(); while (serviceIterator.hasNext()) { BootService bootService = serviceIterator.next(); try { bootService.bootUp(); bootedServices.put(bootService.getClass(), bootService); } catch (Exception e) { logger.error(e, "ServiceStarter try to start [{}] fail.", bootService.getClass().getName()); } Loading @@ -35,6 +40,16 @@ public enum ServiceStarter { } } /** * Find a {@link BootService} implementation, which is already started. * @param serviceClass class name. * @param <T> {@link BootService} implementation class. * @return {@link BootService} instance */ public <T extends BootService> T findService(Class<T> serviceClass){ return (T)bootedServices.get(serviceClass); } ServiceLoader<BootService> load() { return ServiceLoader.load(BootService.class); } Loading
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/client/CollectorClientService.java 0 → 100644 +13 −0 Original line number Diff line number Diff line package com.a.eye.skywalking.api.client; import com.a.eye.skywalking.api.boot.BootService; /** * @author wusheng */ public class CollectorClientService implements BootService { @Override public void bootUp() { } }
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-logback-1.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/logback/v1/x/LogbackPatternConverterActivation.java +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class LogbackPatternConverterActivation extends ClassInstanceMethodsEnhan @Override public String getMethodsInterceptor() { return "com.a.eye.skywalking.toolkit.log.logback.v1.x.PrintTraceIdInterceptor"; return "com.a.eye.skywalking.toolkit.activation.log.logback.v1.x.PrintTraceIdInterceptor"; } }}; } Loading