[Enhancement] In RocketMQ 5.3.4, the rejection policy of the thread pool is set redundantly in the init method of the GrpcMessagingApplication class
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 26
Description
### Before Creating the Enhancement Request
- [x] I have confirmed that this should be classified as an enhancement rather than a bug/feature.
### Summary
In RocketMQ 5.3.4, the rejection policy of the thread pool is set redundantly in the init method of the GrpcMessagingApplication class,the code is as follows :
protected void init() {
GrpcTaskRejectedExecutionHandler rejectedExecutionHandler = new GrpcTaskRejectedExecutionHandler();
this.routeThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.routeThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.producerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.consumerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.clientManagerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.transactionThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
}
### Motivation
this.routeThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler)执行了两次,没有必要。
### Describe the Solution You'd Like
the improved code is as follows :
protected void init() {
GrpcTaskRejectedExecutionHandler rejectedExecutionHandler = new GrpcTaskRejectedExecutionHandler();
this.routeThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.producerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.consumerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.clientManagerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.transactionThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
}
### Describe Alternatives You've Considered
the improved code is as follows :
protected void init() {
GrpcTaskRejectedExecutionHandler rejectedExecutionHandler = new GrpcTaskRejectedExecutionHandler();
this.routeThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.producerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.consumerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.clientManagerThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
this.transactionThreadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
}
### Additional Context
_No response_
Contributor guide
Research direction
Open the GrpcMessagingApplication class and inspect its protected init method, focusing on the repeated routeThreadPoolExecutor rejection-handler assignment. Remove the redundant assignment and confirm that each listed executor is configured once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java
- Domain
- backend, distributed-systems
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100