mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 08:43:02 +08:00
- 调整 InteractionFlowContext 为抽象类,实现者的模块上下文应当继承自该类。 - 完善 Agent 启动类具体逻辑 - 取消 Agent 类中 launchRunners 中关闭虚拟线程池的行为,交由JVM等待线程关闭,而非直接停止整个进程。 - 调整原hook注解分别为 BeforeExecute 、 AfterExecute,该注解用于模块抽象类的子类时可抽取重复逻辑 - 新增 Init 注解,用于执行初始化逻辑,可通过 order 属性指定顺序,默认为 0 - ModuleRegisterFactory 中新增‘加载 Init 注解标注的方法’的相关逻辑 - ModuleCheckFactory 添加对于 Init 注解的校验 - 完善了 ModuleProxyFactory 中设置代理实例的内容,可同时添加pre、post hook逻辑
19 lines
538 B
Java
19 lines
538 B
Java
package module;
|
|
|
|
import net.bytebuddy.implementation.bind.annotation.*;
|
|
|
|
import java.lang.reflect.Method;
|
|
import java.util.concurrent.Callable;
|
|
|
|
public class MyModuleProxyInterceptor {
|
|
public MyModuleProxyInterceptor() {}
|
|
|
|
@RuntimeType
|
|
public Object intercept(@Origin Method method, @AllArguments Object[] allArguments, @SuperCall Callable<?> zuper, @This Object proxy) throws Exception {
|
|
System.out.println("22222");
|
|
Object res = zuper.call();
|
|
System.out.println("11111");
|
|
return res;
|
|
}
|
|
}
|