[ISSUE #11080] Skip unused remoting client event executor - #11081
Merged
lizhimins merged 1 commit intoSep 10, 2026
Merged
Conversation
RockteMQ-AI
approved these changes
Sep 8, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Summary
Clean optimization — skip starting NettyEventExecutor when no ChannelEventListener is configured. The executor thread was polling an empty queue every 3 seconds for nothing, so this saves one thread per client instance that doesn't need channel event callbacks.
Review
- Correctness ✅ — The guard is safe:
channelEventListeneris set in the constructor and effectively final. Connection handlers already skip event submission when the listener is null, so the executor was indeed doing nothing. - Tests ✅ — Good coverage of both paths (with/without listener). The reflection-based thread state verification is a pragmatic choice for lifecycle testing.
- Performance ✅ — Eliminates unnecessary thread creation and periodic wake-ups. Minor but meaningful for deployments with many client instances.
- Compatibility ✅ — No API changes, purely internal optimization.
LGTM.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #11081 +/- ##
=============================================
- Coverage 48.92% 48.89% -0.04%
+ Complexity 13846 13837 -9
=============================================
Files 1382 1382
Lines 101602 101603 +1
Branches 13213 13214 +1
=============================================
- Hits 49709 49678 -31
- Misses 45866 45882 +16
- Partials 6027 6043 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
qianye1001
force-pushed
the
codex/skip-unused-netty-event-executor
branch
from
September 9, 2026 08:54
d1fcab1 to
811c92d
Compare
lizhimins
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Fixes #11080
Brief Description
NettyRemotingClient.start()starts aNettyEventExecutoreven when noChannelEventListeneris configured. Since connection handlers already skip event submission in that case, each such client keeps an unused thread polling an empty queue every three seconds. This includes internal clients built throughMQClientAPIExt.Start the executor only when
channelEventListener != null. Clients with a listener retain their existing event dispatch behavior. The existing shutdown implementation safely handles an executor that was never started.How Did You Test This Change?
Added regression tests covering startup and shutdown without an event thread when no listener is configured, and ACTIVE event delivery plus thread termination when a listener is configured.
Passed on JDK 11:
mvn -B -pl remoting -am -Dtest=NettyRemotingClientTest -Dsurefire.failIfNoSpecifiedTests=false testAll 16 tests passed, including the two new tests. Checkstyle and SpotBugs also passed.