Skip to content

[Enhancement] In RocketMQ 5.3.4, the rejection policy of the thread pool is set redundantly in the init method of the GrpcMessagingApplication class #9930

@709572460

Description

@709572460

Before Creating the Enhancement Request

  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions