Skip to content

feat: Add tracing support for ThreadPoolExecutor.invokeAll/invokeAny (issue apache/skywalking#13945) - #817

Open
cyforkk wants to merge 1 commit into
apache:mainfrom
cyforkk:threadpool-invoke-interceptor
Open

feat: Add tracing support for ThreadPoolExecutor.invokeAll/invokeAny (issue apache/skywalking#13945)#817
cyforkk wants to merge 1 commit into
apache:mainfrom
cyforkk:threadpool-invoke-interceptor

Conversation

@cyforkk

@cyforkk cyforkk commented Jul 29, 2026

Copy link
Copy Markdown

Summary

This PR adds tracing context propagation for ThreadPoolExecutor batch methods.

Changes

  • Added ThreadPoolExecutorInvokeInterceptor to capture and restore tracing context
  • Added ThreadPoolExecutorInstrumentation to intercept:
    • invokeAll(Collection<? extends Callable<T>> tasks)
    • invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
    • invokeAny(Collection<? extends Callable<T>> tasks)
    • invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
  • Registered the new interceptor in skywalking-plugin.def

How it works

The interceptor captures the active tracing context before the method call and wraps
each Callable in the collection to restore the context when executed.

Related

Fixes apache/skywalking#13945

🤖 Generated with Claude Code

…(issue #13945)

Add interceptor to propagate tracing context for batch methods:
- ThreadPoolExecutor.invokeAll() (both overloads)
- ThreadPoolExecutor.invokeAny() (both overloads)

The interceptor captures the active tracing context before the method call
and wraps each Callable to restore the context when executed.

Co-Authored-By: Claude <noreply@anthropic.com>
@wu-sheng

Copy link
Copy Markdown
Member

#816 is on going. If yoi have anything to add, welcome to review and comment there.

@wu-sheng wu-sheng added the duplicate This issue or pull request already exists label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add tracing support for ThreadPoolExecutor.invokeAll and invokeAny in the JDK thread pool plugin

2 participants