Zhuoxi2000 opened a new pull request, #1028: URL: https://github.com/apache/flink-agents/pull/1028
<!-- * Thank you very much for contributing to Flink Agents. * Please add the relevant components in the PR title. E.g., [api], [runtime], [java], [python], [hotfix], etc. --> <!-- Please link the PR to the relevant issue(s). Hotfix doesn't need this. --> Linked issue: #1013 ### Purpose of change <!-- What is the purpose of this change? --> Both async executors relied on default thread names (`pool-N-thread-M` from the JDK 21 `Executors.newFixedThreadPool`, `ThreadPoolExecutor-N_M` from Python), which make Flink Agents async workers hard to attribute in TaskManager thread dumps, profiler output, and monitoring tools — especially idle workers, whose stacks contain only generic frames. Following the naming convention suggested in the issue: - **Java**: a new `AsyncExecutorThreadFactory` names workers `flink-agents-java-async-<pool-id>-thread-<worker-id>`, with a process-unique pool id so multiple executor instances stay distinguishable. The factory lives in the JDK-agnostic `src/main/java` source set (the JDK 21 `ContinuationActionExecutor` consumes it), so it is unit-testable on every JDK. Only the name changes — daemon status and priority follow the default factory behavior. - **Python**: `create_async_thread_pool` passes a process-unique `thread_name_prefix`, yielding `flink-agents-python-async-<pool-id>_<worker-id>` via `ThreadPoolExecutor`'s standard prefix mechanism. ### Tests <!-- How is this change verified? --> - Java: `AsyncExecutorThreadFactoryTest` — tasks submitted to an executor built with the factory run on threads matching `flink-agents-java-async-\d+-thread-\d+`; names are distinct across workers and across factory instances; daemon status and priority are unchanged from the default factory. - Python: `test_async_thread_pool.py` — submitted tasks observe names matching `flink-agents-python-async-\d+_\d+`, and two pools produce distinct prefixes. ### API <!-- Does this change touches any public APIs? --> None; thread naming only, no execution-behavior change. ### Documentation <!-- Do not remove this section. Check the proper box only. --> - [ ] `doc-needed` <!-- Your PR changes impact docs --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-included` <!-- Your PR already contains the necessary documentation updates --> ### Was this patch authored or co-authored using generative AI tooling? <!-- Do not remove this section. Check the proper box only. --> - [x] Yes - [ ] No If yes, include a `Generated-by: <tool name and version> (<model name and version>)` line, for example `Generated-by: Claude Code 2.1.226 (Claude Opus 4.6)`, in the commit message so it reaches Git history. Repeat the same line here for reviewer visibility. See the [ASF generative tooling guidance](https://www.apache.org/legal/generative-tooling.html). Generated-by: Claude Fable 5 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
