Skip to content

CAMEL-20199: Add JMX support for virtual thread executors#21701

Merged
gnodet merged 3 commits intomainfrom
jmx-virtual-thread-executor
Mar 4, 2026
Merged

CAMEL-20199: Add JMX support for virtual thread executors#21701
gnodet merged 3 commits intomainfrom
jmx-virtual-thread-executor

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 4, 2026

Summary

  • Virtual thread executors (ThreadPerTaskExecutor) were silently skipped from JMX registration because LifecycleStrategy.onThreadPoolAdd only accepted ThreadPoolExecutor
  • Added overloaded onThreadPoolAdd/Remove(ExecutorService) default methods to LifecycleStrategy, ManagementObjectStrategy, and ManagementObjectNameStrategy for backward compatibility
  • Created ManagedVirtualThreadExecutorMBean interface and ManagedVirtualThreadExecutor implementation exposing basic attributes (id, sourceId, routeId, isVirtualThread, isShutdown)
  • Updated BaseExecutorServiceManager to notify lifecycle strategies for non-ThreadPoolExecutor instances
  • Updated JmxManagementLifecycleStrategy and DefaultManagementObjectStrategy to handle ExecutorService registration/unregistration

Test plan

  • New ManagedVirtualThreadExecutorTest verifies virtual thread executor MBeans are registered in JMX with correct attributes (JDK 21+)
  • Existing ManagedThreadPoolTest, ManagedThreadPoolWithIdTest, ManagedThreadPoolProfileTest, DualManagedThreadPoolWithIdTest, DualManagedThreadPoolProfileTest all pass
  • CI validation

🤖 Generated with Claude Code

Virtual thread executors (ThreadPerTaskExecutor) were silently skipped
from JMX registration because LifecycleStrategy.onThreadPoolAdd only
accepted ThreadPoolExecutor. This adds overloaded methods for
ExecutorService to register non-ThreadPoolExecutor instances in JMX.

New ManagedVirtualThreadExecutorMBean exposes basic attributes: id,
sourceId, routeId, isVirtualThread, and isShutdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the core label Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@davsclaus
Copy link
Contributor

Run [[ -z $(git status --porcelain) ]] || { echo 'There are uncommitted changes'; git status; echo; echo; git diff; exit 1; }
There are uncommitted changes
HEAD detached at pull/21701/merge
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SedaEndpointBuilderFactory.java
modified: dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/StubEndpointBuilderFactory.java

Match code generator output for blank Javadoc comment lines
in SedaEndpointBuilderFactory and StubEndpointBuilderFactory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet merged commit 29e73b5 into main Mar 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants