diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java index f395fc9c88..d6b9ad8680 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java @@ -1,9 +1,13 @@ package com.fanruan.boot.env; import com.fanruan.boot.PluginComponent; +import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; +import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup; +import com.fanruan.plugin.autonomy.AutonomyClassManagerProvider; +import com.fr.plugin.ExtraClassManager; import javax.servlet.ServletContext; @@ -23,7 +27,9 @@ public class DesignPluginComponent extends PluginComponent { */ @Start public void start() { - super.start(); + // 暂不启动,预留接口 + ExtraClassManager.getInstance().registerAutonomyClassManager(Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).getAll().toArray(new AutonomyClassManagerProvider[0])); + } @Override diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java index d92621d8ac..3403f28df9 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java @@ -65,41 +65,41 @@ public class DesignAnalyzerComponent extends ResourceAffiliate { */ @Start public void start() { - - OptimizeUtil.open(OptimizeUtil.Module.ANALYZER,() -> { - - AnalyzerAssemblyFactory basicFactory = createBasicFactory(); - - // 兼容逻辑 - List backwardsConfigurations = new ArrayList<>(Carina.getApplicationContext().group(AnalyzerKey.class).getAll()); - if (!CollectionUtils.isEmpty(backwardsConfigurations)) { - // 直接初始化,不添加默认值,防止和下面的冲突 - FineAnalyzer.initDirectly(FineAssist.findInstrumentation(), basicFactory, backwardsConfigurations.toArray(new AnalyzerConfiguration[0])); - } - - // 等页面完全打开后,再进行 retransform, 别影响了启动速度 - EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { - - @Override - public void on(Event event, Null param) { - - ExecutorService es = newSingleThreadExecutor(new NamedThreadFactory("designer-analyzer", true)); - try { - // 加入 retransform 部分的逻辑 - List adviceConfigurations = new ArrayList<>(Carina.getApplicationContext().group(AnalyzerAdviceKey.class).getAll()); - - if (!CollectionUtils.isEmpty(adviceConfigurations)) { - AnalyzerConfiguration[] configurations = convertConfigurations(adviceConfigurations); - es.submit(() -> { - DesignerAnalyzer.init(basicFactory, configurations); - }); - } - } finally { - es.shutdown(); - } - } - }); - }); +/// 埋点分析模块等fbp那边把逻辑理顺了再加上去 +// OptimizeUtil.open(OptimizeUtil.Module.ANALYZER,() -> { +// +// AnalyzerAssemblyFactory basicFactory = createBasicFactory(); +// +// // 兼容逻辑 +// List backwardsConfigurations = new ArrayList<>(Carina.getApplicationContext().group(AnalyzerKey.class).getAll()); +// if (!CollectionUtils.isEmpty(backwardsConfigurations)) { +// // 直接初始化,不添加默认值,防止和下面的冲突 +// FineAnalyzer.initDirectly(FineAssist.findInstrumentation(), basicFactory, backwardsConfigurations.toArray(new AnalyzerConfiguration[0])); +// } +// +// // 等页面完全打开后,再进行 retransform, 别影响了启动速度 +// EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { +// +// @Override +// public void on(Event event, Null param) { +// +// ExecutorService es = newSingleThreadExecutor(new NamedThreadFactory("designer-analyzer", true)); +// try { +// // 加入 retransform 部分的逻辑 +// List adviceConfigurations = new ArrayList<>(Carina.getApplicationContext().group(AnalyzerAdviceKey.class).getAll()); +// +// if (!CollectionUtils.isEmpty(adviceConfigurations)) { +// AnalyzerConfiguration[] configurations = convertConfigurations(adviceConfigurations); +// es.submit(() -> { +// DesignerAnalyzer.init(basicFactory, configurations); +// }); +// } +// } finally { +// es.shutdown(); +// } +// } +// }); +// }); } @NotNull @@ -116,35 +116,37 @@ public class DesignAnalyzerComponent extends ResourceAffiliate { */ @Supplemental public void prepare() { - Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( - ElementMatchers.isAnnotatedWith(Focus.class), - FocusAdvice.class - )); - Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( - ElementMatchers.isAnnotatedWith(Compute.class), - MonitorAdvice.class - )); - Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( - ElementMatchers.isAnnotatedWith(DBMetrics.class), - DBMonitorAdvice.class - )); - Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( - ElementMatchers.isAnnotatedWith(PerformancePoint.class), - PerformancePointAdvice.class - )); - Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( - ElementMatchers.isAnnotatedWith(FaultTolerance.class), - FaultToleranceAdvice.class - )); - // 保持M1 可用 - Carina.getApplicationContext().group(AnalyzerKey.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder - .method(ElementMatchers.isAnnotatedWith(Collect.class)) - .intercept(MethodDelegation.to(CollectInterceptor.class)))); - Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( - ElementMatchers.isAnnotatedWith(Collect.class), - CollectAdvice.class - )); +/// 埋点分析模块等fbp那边把逻辑理顺了再加上去 +// Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( +// ElementMatchers.isAnnotatedWith(Focus.class), +// FocusAdvice.class +// )); +// Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( +// ElementMatchers.isAnnotatedWith(Compute.class), +// MonitorAdvice.class +// )); +// Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( +// ElementMatchers.isAnnotatedWith(DBMetrics.class), +// DBMonitorAdvice.class +// )); +// Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( +// ElementMatchers.isAnnotatedWith(PerformancePoint.class), +// PerformancePointAdvice.class +// )); +// Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( +// ElementMatchers.isAnnotatedWith(FaultTolerance.class), +// FaultToleranceAdvice.class +// )); +// // 保持M1 可用 +// Carina.getApplicationContext().group(AnalyzerKey.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder +// .method(ElementMatchers.isAnnotatedWith(Collect.class)) +// .intercept(MethodDelegation.to(CollectInterceptor.class)))); +// +// Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( +// ElementMatchers.isAnnotatedWith(Collect.class), +// CollectAdvice.class +// )); }