We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AREX Java Agent (arextest/arex-agent-java)
dubbo服务作为入口,方法里使用CompletableFuture进行了两次异步调用,第二次调用依赖第一次返回结果,发现只录制到了第一次的dubbo请求,第二次没有录上。
我们async接口内部实现是调用的dubbo方法,这里为了简单复现问题,实现了两个service做查询,配置动态类模拟录制过程。
controller类: @GetMapping("test/test12") public String test12() { CompletableFuture future = async(true, "abc").thenApply(result -> { System.out.println("1getValue:" + result); return result + "-线程1"; }).thenCompose(this::getFutureValue); String s = ""; try { s = future.get(); System.out.println("result:" + s); } catch (Exception e) { throw new RuntimeException(e); } return "success"; }
public CompletableFuture<String> async(boolean isConfig, String txt) { return CompletableFuture.supplyAsync(() -> { if (isConfig) { return ConfigService.getConfig(txt); } else { return CacheService.getValue(txt); } }, this.executorService); } private CompletableFuture<String> getFutureValue(String result) { return async(false, result).thenApply(re -> { System.out.println("2getValue:" + re); return re + "-线程2"; }); }
service1: public class ConfigService {
private static final ConfigService configService = new ConfigService(); public static ConfigService getInstance() { return configService; } private ConfigService() { } public static String getConfig(String key) { return "config-" + key; }
}
service2: public class CacheService {
private static final CacheService cacheService = new CacheService(); public static CacheService getInstance() { return cacheService; } private CacheService() { } public static String getValue(String key) { return key + "-" + key; }
CompletableFuture 两次异步调用都能录制
""
No response
The text was updated successfully, but these errors were encountered:
你好 感谢反馈,thenCompose本身就是异步线程创建的,内部又嵌套了一层async(false, result)异步方法,是否可以平铺开,怀疑是嵌套回调无法识别到线程的切换
Sorry, something went wrong.
lucas-myx
No branches or pull requests
Search before asking
AREX Test Service
AREX Java Agent (arextest/arex-agent-java)
Current Behavior
dubbo服务作为入口,方法里使用CompletableFuture进行了两次异步调用,第二次调用依赖第一次返回结果,发现只录制到了第一次的dubbo请求,第二次没有录上。
我们async接口内部实现是调用的dubbo方法,这里为了简单复现问题,实现了两个service做查询,配置动态类模拟录制过程。
controller类:
@GetMapping("test/test12")
public String test12() {
CompletableFuture future = async(true, "abc").thenApply(result -> {
System.out.println("1getValue:" + result);
return result + "-线程1";
}).thenCompose(this::getFutureValue);
String s = "";
try {
s = future.get();
System.out.println("result:" + s);
} catch (Exception e) {
throw new RuntimeException(e);
}
return "success";
}
service1:
public class ConfigService {
}
service2:
public class CacheService {
}
Expected Behavior
CompletableFuture 两次异步调用都能录制
Steps To Reproduce
""
Anything else
No response
Are you willing to submit a pull request to fix on your own?
The text was updated successfully, but these errors were encountered: