-
Notifications
You must be signed in to change notification settings - Fork 9
feature: 添加springboot 2.3.x - 2.7.x 线程池适配:ThreadPoolTaskScheduler, ThreadPoolTaskScheduler #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feature: 添加springboot 2.3.x - 2.7.x 线程池适配:ThreadPoolTaskScheduler, ThreadPoolTaskScheduler #13
Conversation
WalkthroughThe changes involve the addition of several new modules in the Changes
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (16)
- koupleless-adapter-springboot-2.3/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-springboot-2.7/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- pom.xml (1 hunks)
Files skipped from review due to trivial changes (4)
- koupleless-adapter-springboot-2.3/pom.xml
- koupleless-adapter-springboot-2.4.6/pom.xml
- koupleless-adapter-springboot-2.7/pom.xml
- pom.xml
Additional comments not posted (19)
koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1)
18-26: Duplicate of the issue noted in the Spring Boot 2.3 version regarding the use of reflection.koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1)
18-26: Duplicate of the issue noted in the Spring Boot 2.3 version regarding the use of reflection.koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
22-30: Duplicate of the issue noted in the Spring Boot 2.3 version regarding the use of reflection.koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
22-30: Duplicate of the issue noted in the Spring Boot 2.3 version regarding the use of reflection.koupleless-adapter-springboot-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1)
36-55: Configuration methods for task scheduling are well-structured and use Spring's conditional annotations effectively.koupleless-adapter-springboot-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1)
57-61: Addition ofscheduledBeanLazyInitializationExcludeFiltermethod is a thoughtful performance optimization.koupleless-adapter-springboot-2.4.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (4)
21-21: Consider verifying the existence ofKouplelessThreadPoolTaskSchedulerin the project.Verification successful
The search results confirm the existence of the
KouplelessThreadPoolTaskSchedulerclass in multiple versions of the project, including the specific version mentioned in the review comment (Spring Boot 2.4.6). This verification aligns with the initial concern raised in the review comment about ensuring the existence of this class within the project.
Class
KouplelessThreadPoolTaskSchedulerFound Across Multiple VersionsThe class
KouplelessThreadPoolTaskScheduleris indeed present in the project, including the specific version referenced in the review comment (Spring Boot 2.4.6). This confirms that the import statement in theTaskSchedulingAutoConfiguration.javafile is valid and correctly references an existing class within the project.
- File Locations:
koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.javakoupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.javakoupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.javaScripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of KouplelessThreadPoolTaskScheduler in the project. # Test: Search for the class definition. Expect: At least one occurrence. rg --type java 'class KouplelessThreadPoolTaskScheduler'Length of output: 666
56-56: Ensure that theTaskSchedulerBuilderis properly configured to useKouplelessThreadPoolTaskScheduler.
60-62: Verify thatScheduledBeanLazyInitializationExcludeFilteris correctly implemented and available.
66-75: Review the configuration logic intaskSchedulerBuilderto ensure all properties are correctly applied.koupleless-adapter-springboot-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (3)
19-19: Verify the existence ofKouplelessThreadPoolTaskExecutorin the project.Verification successful
The search results confirm the existence of the
KouplelessThreadPoolTaskExecutorclass in multiple versions of the project, including the specific version mentioned in the review comment (Spring Boot 2.3). This verification aligns with the import statement in theTaskExecutionAutoConfiguration.javafile, indicating that the class is indeed part of the project and correctly referenced.
KouplelessThreadPoolTaskExecutor is confirmed to exist in the project.
- The class is found in the
koupleless-adapter-springboot-2.3directory, which matches the context of the file under review.- It is also present in other versions, indicating consistent usage across different versions of the project.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of KouplelessThreadPoolTaskExecutor in the project. # Test: Search for the class definition. Expect: At least one occurrence. rg --type java 'class KouplelessThreadPoolTaskExecutor'Length of output: 656
57-73: Review the configuration logic intaskExecutorBuilderto ensure all properties are correctly applied.
77-82: Ensure that theTaskExecutorBuilderis properly configured to useKouplelessThreadPoolTaskExecutor.koupleless-adapter-springboot-2.4.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (3)
19-19: Verify the existence ofKouplelessThreadPoolTaskExecutorin the project.Verification successful
The verification process has confirmed the existence of the
KouplelessThreadPoolTaskExecutorclass in multiple versions of the project, including the specific version 2.4.6 mentioned in the review comment. This class is indeed part of the project and is located in the expected directory structure undercom/alipay/sofa/koupleless/common.Given this information, the review comment is accurate in its request to verify the existence of this class within the project. The class is present and correctly placed, which aligns with the import statement in the
TaskExecutionAutoConfiguration.javafile for the Spring Boot 2.4.6 adapter.Final Response:
The
KouplelessThreadPoolTaskExecutorclass exists in the project and is correctly referenced in the import statement of theTaskExecutionAutoConfiguration.javafile for Spring Boot version 2.4.6. This verification confirms the accuracy of the import and the existence of the class across multiple versions of the project.
- Location:
koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.javaScripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of KouplelessThreadPoolTaskExecutor in the project. # Test: Search for the class definition. Expect: At least one occurrence. rg --type java 'class KouplelessThreadPoolTaskExecutor'Length of output: 656
57-73: Review the configuration logic intaskExecutorBuilderto ensure all properties are correctly applied.
77-82: Ensure that theTaskExecutorBuilderis properly configured to useKouplelessThreadPoolTaskExecutor.koupleless-adapter-springboot-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (3)
19-19: Verify the existence ofKouplelessThreadPoolTaskExecutorin the project.Verification successful
The search results confirm the existence of the
KouplelessThreadPoolTaskExecutorclass across multiple versions of the project, including the specific version 2.7 mentioned in the review comment. This verification aligns with the initial inquiry about the presence of this class within the project's codebase.
Verification of
KouplelessThreadPoolTaskExecutorThe class
KouplelessThreadPoolTaskExecutoris indeed present in the project, including in the version 2.7 directory as specified in the review comment. This confirms that the class is available for use in the context of task execution configurations in Spring Boot 2.7.
- Location:
koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.javaScripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of KouplelessThreadPoolTaskExecutor in the project. # Test: Search for the class definition. Expect: At least one occurrence. rg --type java 'class KouplelessThreadPoolTaskExecutor'Length of output: 656
57-73: Review the configuration logic intaskExecutorBuilderto ensure all properties are correctly applied.
77-82: Ensure that theTaskExecutorBuilderis properly configured to useKouplelessThreadPoolTaskExecutor.
| @Override | ||
| protected ExecutorService initializeExecutor( | ||
| ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ExecutorService executorService = super.initializeExecutor(threadFactory, rejectedExecutionHandler); | ||
| KouplelessExecutorServiceAdaptor executor = new KouplelessExecutorServiceAdaptor(executorService); | ||
| ClassUtil.setField("threadPoolExecutor", this, executor); | ||
| return executor; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflection used in initializeExecutor method to set threadPoolExecutor field.
Reflection can lead to maintenance issues and breaks encapsulation. Consider using a more robust method to achieve the same functionality, possibly through design changes that avoid direct field manipulation.
| @Override | ||
| protected ExecutorService initializeExecutor( | ||
| ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ScheduledExecutorService scheduledExecutor = (ScheduledExecutorService) super.initializeExecutor(threadFactory, rejectedExecutionHandler); | ||
| ScheduledExecutorService executor = new KouplelessScheduledExecutorServiceAdaptor(scheduledExecutor); | ||
| ClassUtil.setField("scheduledExecutor", this, executor); | ||
| return executor; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflection used in initializeExecutor method to set scheduledExecutor field.
Reflection can lead to maintenance issues and breaks encapsulation. Consider using a more robust method to achieve the same functionality, possibly through design changes that avoid direct field manipulation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.7/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
Files skipped from review as they are similar to previous changes (8)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
- koupleless-adapter-springboot-2.4.6/pom.xml
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
- koupleless-adapter-springboot-2.7/pom.xml
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
Files skipped from review as they are similar to previous changes (6)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- koupleless-adapter-springboot-2.3/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-springboot-2.7/pom.xml (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
Files skipped from review as they are similar to previous changes (9)
- koupleless-adapter-springboot-2.3/pom.xml
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
- koupleless-adapter-springboot-2.4.6/pom.xml
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
- koupleless-adapter-springboot-2.7/pom.xml
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java
- koupleless-adapter-springboot-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Out of diff range and nitpick comments (2)
koupleless-adapter-executorservice-spring-2.3-2.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1)
76-82: The method correctly configures theThreadPoolTaskExecutorwith a custom executor. Consider adding a comment explaining whyKouplelessThreadPoolTaskExecutoris used, to improve code readability.koupleless-adapter-executor-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1)
76-82: The method correctly configures theThreadPoolTaskExecutorwith a custom executor. Enhance the modification comment to specify what was changed for better clarity and maintainability.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (16)
- koupleless-adapter-executor-spring-2.7/pom.xml (1 hunks)
- koupleless-adapter-executor-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-executor-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-executor-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-executor-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-executorservice-spring-2.3-2.6/pom.xml (1 hunks)
- koupleless-adapter-executorservice-spring-2.3-2.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-executorservice-spring-2.3-2.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.3-2.4.5/pom.xml (1 hunks)
- koupleless-adapter-scheduler-spring-2.3-2.4.5/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.3-2.4.5/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6-2.7/pom.xml (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-springboot-2.3/pom.xml (1 hunks)
- pom.xml (1 hunks)
Files skipped from review due to trivial changes (4)
- koupleless-adapter-executor-spring-2.7/pom.xml
- koupleless-adapter-executorservice-spring-2.3-2.6/pom.xml
- koupleless-adapter-scheduler-spring-2.3-2.4.5/pom.xml
- koupleless-adapter-scheduler-spring-2.4.6-2.7/pom.xml
Files skipped from review as they are similar to previous changes (2)
- koupleless-adapter-springboot-2.3/pom.xml
- pom.xml
Additional comments not posted (10)
koupleless-adapter-executor-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1)
33-41: Well implemented method to customize the executor service. Consider adding documentation to explain the custom behavior introduced here.koupleless-adapter-executorservice-spring-2.3-2.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1)
33-41: Identical implementation as in Spring 2.7 version. Ensure documentation is added to explain the custom behavior.koupleless-adapter-executor-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
34-43: Well implemented method to customize the scheduled executor service. Consider adding documentation to explain the custom behavior introduced here.koupleless-adapter-scheduler-spring-2.3-2.4.5/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
34-43: Identical implementation as in Spring 2.7 version. Ensure documentation is added to explain the custom behavior.koupleless-adapter-scheduler-spring-2.4.6-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
34-43: Identical implementation as in other versions. Ensure documentation is added to explain the custom behavior.koupleless-adapter-scheduler-spring-2.3-2.4.5/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1)
52-58: Proper integration ofKouplelessThreadPoolTaskSchedulerinto the Spring context. Consider adding documentation to clarify how this custom scheduler is configured.koupleless-adapter-executor-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1)
50-62: Proper integration ofKouplelessThreadPoolTaskSchedulerand addition of lazy initialization exclusion filter. Consider adding documentation to clarify these configurations.koupleless-adapter-scheduler-spring-2.4.6-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1)
52-63: Proper integration ofKouplelessThreadPoolTaskSchedulerand addition of lazy initialization exclusion filter. Consider adding documentation to clarify these configurations.koupleless-adapter-executorservice-spring-2.3-2.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1)
55-73: The configuration of theTaskExecutorBuilderis correctly implemented and follows best practices.koupleless-adapter-executor-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1)
55-73: The configuration of theTaskExecutorBuilderis consistently implemented across versions, which is good for maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- koupleless-adapter-dubbo-3.1/pom.xml (1 hunks)
- koupleless-adapter-dubbo-3.2/pom.xml (1 hunks)
Files skipped from review due to trivial changes (2)
- koupleless-adapter-dubbo-3.1/pom.xml
- koupleless-adapter-dubbo-3.2/pom.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…er' into lipeng_dev_thread_with_classloader # Conflicts: # pom.xml
|
需要先修复 declaredMode 白名单能力后,再使用 classloader 与线程池绑定的功能 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (16)
- koupleless-adapter-executorservice-spring-2.3/pom.xml (1 hunks)
- koupleless-adapter-executorservice-spring-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-executorservice-spring-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-executorservice-spring-2.7/pom.xml (1 hunks)
- koupleless-adapter-executorservice-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-executorservice-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.3/pom.xml (1 hunks)
- koupleless-adapter-scheduler-spring-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6/pom.xml (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.7/pom.xml (1 hunks)
- koupleless-adapter-scheduler-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1 hunks)
- pom.xml (2 hunks)
Files skipped from review due to trivial changes (5)
- koupleless-adapter-executorservice-spring-2.3/pom.xml
- koupleless-adapter-executorservice-spring-2.7/pom.xml
- koupleless-adapter-scheduler-spring-2.3/pom.xml
- koupleless-adapter-scheduler-spring-2.4.6/pom.xml
- koupleless-adapter-scheduler-spring-2.7/pom.xml
Files skipped from review as they are similar to previous changes (1)
- pom.xml
Additional comments not posted (11)
koupleless-adapter-scheduler-spring-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (1)
52-71: Well-structured methods for task scheduler configuration.The use of conditional annotations ensures that beans are only created when appropriate, and the integration with the custom
KouplelessThreadPoolTaskScheduleris done cleanly.koupleless-adapter-scheduler-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (3)
58-62: This method correctly implements a lazy initialization exclude filter for scheduled beans.
50-56: EnsureKouplelessThreadPoolTaskScheduleris fully compatible with Spring Boot 2.7.
64-75: Confirm that all properties fromTaskSchedulingPropertiesare correctly utilized in the builder pattern.koupleless-adapter-scheduler-spring-2.4.6/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java (3)
60-63: This method correctly implements a lazy initialization exclude filter for scheduled beans.
52-58: EnsureKouplelessThreadPoolTaskScheduleris fully compatible with Spring Boot 2.4.6.
65-76: Confirm that all properties fromTaskSchedulingPropertiesare correctly utilized in the builder pattern.koupleless-adapter-executorservice-spring-2.3/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (2)
55-73: EnsureTaskExecutorBuilderis fully compatible with Spring Boot 2.3.
76-82: EnsureKouplelessThreadPoolTaskExecutoris fully compatible with Spring Boot 2.3.koupleless-adapter-executorservice-spring-2.7/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.java (2)
55-73: EnsureTaskExecutorBuilderis fully compatible with Spring Boot 2.7.
76-82: EnsureKouplelessThreadPoolTaskExecutoris fully compatible with Spring Boot 2.7.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ExecutorService executorService = super.initializeExecutor(threadFactory, | ||
| rejectedExecutionHandler); | ||
| KouplelessExecutorService executor = new KouplelessExecutorService(executorService); | ||
| ClassUtil.setField("threadPoolExecutor", this, executor); | ||
| return executor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider alternatives to using reflection for setting fields to enhance type safety and maintainability.
Reflection can lead to maintenance issues and is less type-safe. If possible, consider modifying the design to allow setting the executor without reflection, perhaps through constructor injection or a setter method.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ExecutorService executorService = super.initializeExecutor(threadFactory, | ||
| rejectedExecutionHandler); | ||
| KouplelessExecutorService executor = new KouplelessExecutorService(executorService); | ||
| ClassUtil.setField("threadPoolExecutor", this, executor); | ||
| return executor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider alternatives to using reflection for setting fields to enhance type safety and maintainability.
As with the Spring 2.3 version, using reflection here can lead to maintenance issues and is less type-safe. Consider modifying the design to allow setting the executor without reflection.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ScheduledExecutorService scheduledExecutor = (ScheduledExecutorService) super.initializeExecutor( | ||
| threadFactory, rejectedExecutionHandler); | ||
| ScheduledExecutorService executor = new KouplelessScheduledExecutorService( | ||
| scheduledExecutor); | ||
| ClassUtil.setField("scheduledExecutor", this, executor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider alternatives to using reflection for setting fields to enhance type safety and maintainability.
Using reflection to set the scheduledExecutor field can lead to maintenance issues. Consider alternatives such as constructor injection or a setter method to enhance type safety and maintainability.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ScheduledExecutorService scheduledExecutor = (ScheduledExecutorService) super.initializeExecutor( | ||
| threadFactory, rejectedExecutionHandler); | ||
| ScheduledExecutorService executor = new KouplelessScheduledExecutorService( | ||
| scheduledExecutor); | ||
| ClassUtil.setField("scheduledExecutor", this, executor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider alternatives to using reflection for setting fields to enhance type safety and maintainability.
As with the Spring 2.3 version, using reflection here can lead to maintenance issues. Consider modifying the design to allow setting the executor without reflection.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ScheduledExecutorService scheduledExecutor = (ScheduledExecutorService) super.initializeExecutor( | ||
| threadFactory, rejectedExecutionHandler); | ||
| ScheduledExecutorService executor = new KouplelessScheduledExecutorService( | ||
| scheduledExecutor); | ||
| ClassUtil.setField("scheduledExecutor", this, executor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider alternatives to using reflection for setting fields to enhance type safety and maintainability.
As with the earlier versions, using reflection here can lead to maintenance issues. Consider modifying the design to allow setting the executor without reflection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- koupleless-adapter-executorservice-spring-2.7/pom.xml (1 hunks)
- koupleless-adapter-scheduler-spring-2.7/pom.xml (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- koupleless-adapter-executorservice-spring-2.7/pom.xml
- koupleless-adapter-scheduler-spring-2.7/pom.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- koupleless-adapter-executorservice-spring-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-executorservice-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.3/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- koupleless-adapter-scheduler-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1 hunks)
- pom.xml (1 hunks)
Files skipped from review due to trivial changes (1)
- pom.xml
Additional comments not posted (3)
koupleless-adapter-executorservice-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskExecutor.java (1)
33-41: Reiterate the need to avoid using reflection.As previously discussed for the Spring 2.3 version, the use of
ReflectionUtils.setFieldremains a concern here. It's crucial to consider alternatives that enhance type safety and maintainability, such as adding a setter method or using constructor injection.koupleless-adapter-scheduler-spring-2.4.6/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
34-42: Reiterate the need to avoid using reflection.As previously discussed for the Spring 2.3 version, the use of
ReflectionUtils.setFieldremains a concern here. It's crucial to consider alternatives that enhance type safety and maintainability, such as adding a setter method or using constructor injection.koupleless-adapter-scheduler-spring-2.7/src/main/java/com/alipay/sofa/koupleless/common/KouplelessThreadPoolTaskScheduler.java (1)
34-44: Consider alternatives to using reflection for setting fields to enhance type safety and maintainability.As with the earlier versions, using reflection here can lead to maintenance issues. Consider modifying the design to allow setting the executor without reflection. This could potentially be achieved by modifying the superclass to provide a setter or by using a different design pattern that doesn't require direct field access.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ExecutorService executorService = super.initializeExecutor(threadFactory, | ||
| rejectedExecutionHandler); | ||
| KouplelessExecutorService executor = new KouplelessExecutorService(executorService); | ||
| ReflectionUtils.setField("threadPoolExecutor", this, executor); | ||
| return executor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconsider the use of reflection for setting fields.
The use of ReflectionUtils.setField to inject the custom executor service (KouplelessExecutorService) into the threadPoolExecutor field may lead to maintenance issues and is less type-safe. Consider alternatives such as constructor injection or a setter method, which could enhance type safety and maintainability.
- ReflectionUtils.setField("threadPoolExecutor", this, executor);
+ // Recommended to add a setter method in the parent class if possible
+ this.setThreadPoolExecutor(executor);Committable suggestion was skipped due to low confidence.
| @Override | ||
| protected ExecutorService initializeExecutor(ThreadFactory threadFactory, | ||
| RejectedExecutionHandler rejectedExecutionHandler) { | ||
|
|
||
| ScheduledExecutorService scheduledExecutor = (ScheduledExecutorService) super.initializeExecutor( | ||
| threadFactory, rejectedExecutionHandler); | ||
| ScheduledExecutorService executor = new KouplelessScheduledExecutorService( | ||
| scheduledExecutor); | ||
| ReflectionUtils.setField("scheduledExecutor", this, executor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the use of reflection in setting the scheduler field.
Using reflection to set the scheduledExecutor field can lead to maintenance challenges. Alternative approaches such as constructor injection or a setter method should be considered to improve type safety and maintainability.
- ReflectionUtils.setField("scheduledExecutor", this, executor);
+ // Recommended to add a setter method in the parent class if possible
+ this.setScheduledExecutor(executor);Committable suggestion was skipped due to low confidence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
pom.xml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: unit-test-for-sofaboot-samples
- GitHub Check: unit-test-for-dubbo-samples
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: unit-test-for-dubbo32-samples
- GitHub Check: unit-test-for-springboot-samples
- GitHub Check: unit-test-for-springboot3-samples
|
|
||
| <module>koupleless-adapter-scheduler-spring-2.4.6</module> | ||
| <module>koupleless-adapter-scheduler-spring-2.3</module> | ||
| <module>koupleless-adapter-scheduler-spring-2.7</module> | ||
| <module>koupleless-adapter-executorservice-spring-2.3</module> | ||
| <module>koupleless-adapter-executorservice-spring-2.7</module> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
New Module Additions for ThreadPoolTaskScheduler and ExecutorService Support
The new modules introduced in these lines extend the project to support thread pool adaptation for Spring Boot versions 2.3.x to 2.7.x. In particular, the following modules have been added:
<module>koupleless-adapter-scheduler-spring-2.4.6</module><module>koupleless-adapter-scheduler-spring-2.3</module><module>koupleless-adapter-scheduler-spring-2.7</module><module>koupleless-adapter-executorservice-spring-2.3</module><module>koupleless-adapter-executorservice-spring-2.7</module>
Please consider the following:
- Naming Consistency: Verify that the module names clearly convey the supported Spring Boot version ranges based on the established project convention (e.g., as noted in previous comments, koupleless-adapter-scheduler-spring-2.3 implies 2.3–2.4.5, 2.4.6 implies 2.4.6–2.7, etc.).
- Logical Ordering: Ensure the new modules are inserted into the
<modules>section in a logical order for maintainability and clarity. - Integration with Adaptation Logic: Confirm that each newly added module includes the appropriate configuration and implementation for adapting to
ThreadPoolTaskScheduler(and related thread pool binding features) as laid out in the PR objectives. - DeclaredMode Whitelist Dependency: As highlighted in the PR comments, make sure the
declaredModewhitelist capability issue is fully resolved in the related components before the classloader–thread pool binding functionality is leveraged.
Summary by CodeRabbit