Browse Source

feat: KERNEL-10354 bytebuddy / 加解密性能优化 @Harrison

1. 删掉一部分代码,精简整体逻辑
feature/x
Harrison 3 years ago
parent
commit
56f1f97761
  1. 17
      designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerActivator.java
  2. 4
      designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAssemblyFactory.java

17
designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerActivator.java

@ -21,7 +21,6 @@ import com.fr.record.analyzer.AnalyzerConfiguration;
import com.fr.record.analyzer.AnalyzerKey;
import com.fr.record.analyzer.DBMetrics;
import com.fr.record.analyzer.FineAnalyzer;
import com.fr.record.analyzer.advice.AnalyzerAdviceConfiguration;
import com.fr.record.analyzer.advice.AnalyzerAdviceKey;
import com.fr.record.analyzer.advice.FineAdviceAssistant;
import com.fr.record.analyzer.configuration.AnalyzerAssemblyFactory;
@ -60,7 +59,7 @@ public class DesignerAnalyzerActivator extends Activator implements Prepare {
ExecutorService es = newSingleThreadExecutor(new NamedThreadFactory("designer-analyzer", true));
try {
// 加入 retransform 部分的逻辑
List<AnalyzerAdviceConfiguration> adviceConfigurations = findMutable(AnalyzerAdviceKey.KEY);
List<FineAdviceAssistant> adviceConfigurations = findMutable(AnalyzerAdviceKey.KEY);
if (!CollectionUtils.isEmpty(adviceConfigurations)) {
AnalyzerConfiguration[] configurations = convertConfigurations(adviceConfigurations);
@ -77,10 +76,10 @@ public class DesignerAnalyzerActivator extends Activator implements Prepare {
}
@NotNull
private AnalyzerConfiguration[] convertConfigurations(List<AnalyzerAdviceConfiguration> list) {
private AnalyzerConfiguration[] convertConfigurations(List<FineAdviceAssistant> list) {
return list.stream()
.map((e) -> AnalyzerConfiguration.create(new FineAdviceAssistant(e.getMatcher(), e.getAdviceClass())))
.map(AnalyzerConfiguration::create)
.toArray(AnalyzerConfiguration[]::new);
}
@ -92,27 +91,27 @@ public class DesignerAnalyzerActivator extends Activator implements Prepare {
@Override
public void prepare() {
addMutable(AnalyzerAdviceKey.KEY, AnalyzerAdviceConfiguration.create(
addMutable(AnalyzerAdviceKey.KEY, FineAdviceAssistant.create(
ElementMatchers.isAnnotatedWith(Focus.class),
FocusAdvice.class
));
addMutable(AnalyzerAdviceKey.KEY, AnalyzerAdviceConfiguration.create(
addMutable(AnalyzerAdviceKey.KEY, FineAdviceAssistant.create(
ElementMatchers.isAnnotatedWith(Compute.class),
MonitorAdvice.class
));
addMutable(AnalyzerAdviceKey.KEY, AnalyzerAdviceConfiguration.create(
addMutable(AnalyzerAdviceKey.KEY, FineAdviceAssistant.create(
ElementMatchers.isAnnotatedWith(DBMetrics.class),
DBMonitorAdvice.class
));
addMutable(AnalyzerAdviceKey.KEY, AnalyzerAdviceConfiguration.create(
addMutable(AnalyzerAdviceKey.KEY, FineAdviceAssistant.create(
ElementMatchers.isAnnotatedWith(PerformancePoint.class),
PerformancePointAdvice.class
));
addMutable(AnalyzerAdviceKey.KEY, AnalyzerAdviceConfiguration.create(
addMutable(AnalyzerAdviceKey.KEY, FineAdviceAssistant.create(
ElementMatchers.isAnnotatedWith(FaultTolerance.class),
FaultToleranceAdvice.class
));

4
designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAssemblyFactory.java

@ -12,7 +12,7 @@ import java.util.Map;
*
* created by Harrison on 2022/03/07
**/
public class DesignerAssemblyFactory implements AnalyzerAssemblyFactory {
public class DesignerAssemblyFactory implements AnalyzerAssemblyFactory<Void> {
/**
* 每次执行 1 class retransform
@ -38,7 +38,7 @@ public class DesignerAssemblyFactory implements AnalyzerAssemblyFactory {
}
@Override
public AnalyzerAssemblyFactory prepare(Object material) {
public AnalyzerAssemblyFactory<Void> prepare(Void material) {
return this;
}

Loading…
Cancel
Save