Skip to content
New issue

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

如何在CompletableFuture中开启TTL支持? #151

Closed
cmershen1 opened this issue Oct 8, 2019 · 1 comment
Closed

如何在CompletableFuture中开启TTL支持? #151

cmershen1 opened this issue Oct 8, 2019 · 1 comment
Assignees
Labels
duplicate ❓question Further information is requested

Comments

@cmershen1
Copy link

cmershen1 commented Oct 8, 2019

我使用log4j2-ttl-thread-context-map实现线程间的请求链路跟踪。

发现每次使用CompletableFuture时,日志打出的traceid都是一样的,是否不支持CompletableFuture

@oldratlee
Copy link
Member

oldratlee commented Oct 8, 2019

CompletableFuture是通过ForkJoinPool来运行,可以 @cmershen1

  • 通过TtlRunnable/TtlCallable/TtlWrappers 修饰 输入的Runnable/Callable/Supplier/Function/...
    • 示例:CompletableFuture.runAsync(TtlRunnable.get(bizRunnable))
  • 通过TTL Agent的来开启TTLForkJoinPool透明集成
    image

更多说明参见TTL文档:


重复Issues:

@alibaba alibaba locked as off-topic and limited conversation to collaborators Oct 8, 2019
@oldratlee oldratlee self-assigned this Oct 8, 2019
@oldratlee oldratlee changed the title 不支持CompletableFuture? 如何在CompletableFuture中开启TTL支持? Oct 24, 2019
@oldratlee oldratlee added the ❓question Further information is requested label Oct 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate ❓question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants