709572460 opened a new issue, #9930:
URL: https://github.com/apache/rocketmq/issues/9930
### 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_
--
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]