Carpe-Wang opened a new pull request, #3481: URL: https://github.com/apache/hertzbeat/pull/3481
feat: Add dedicated thread pool for RestTemplate in alert notification system ## What's changed? - **RestTemplate thread pool** Added a `restTemplateThreadPool` bean in `hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/config/RestTemplateConfig.java` with: - Core threads: 10 - Max threads: 50 - Queue capacity: 200 - Thread name prefix: `RestTemplate-` - Rejection policy: `CallerRunsPolicy` - **Async alert notification** In `hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/notice/impl/AbstractAlertNotifyHandlerImpl.java` introduced a `sendAsync()` method and injected the new thread‐pool executor to offload HTTP calls. - **Parallel dispatch optimization** Updated `hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/notice/AlertNoticeDispatch.java` to: - Use `CompletableFuture` for sending notifications in parallel - Handle errors per‐receiver without blocking others - Accept the thread‐pool executor via constructor - **Test updates** In `hertzbeat-alerter/src/test/java/org/apache/hertzbeat/alert/notice/AlertNoticeDispatchTest.java` updated the constructor calls to pass a mock executor and added test cases covering the async paths. ## Checklist - [ ] I have read the [Contributing Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide) - [ ] I have written the necessary doc or comment. - [ ] I have added the necessary unit tests and all cases have passed. ## Add or update API - [ ] I have added the necessary [e2e tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have passed. -- 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: notifications-unsubscr...@hertzbeat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org For additional commands, e-mail: notifications-h...@hertzbeat.apache.org