-
Notifications
You must be signed in to change notification settings - Fork 8.9k
refactor: Refactor DataSourceProxy #7615
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: 2.x
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR refactors the DataSourceProxy class by extracting database-specific resource ID initialization logic into separate initializer classes using a registry pattern. This improves code organization and maintainability by removing the large if-else chain from the DataSourceProxy.
- Extracted resource ID initialization logic into separate database-specific initializer classes
- Created a registry pattern to manage and select appropriate initializers
- Simplified the DataSourceProxy class by delegating initialization to the registry system
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
DataSourceProxy.java | Removed database-specific initialization methods and replaced with registry-based delegation |
ResourceIdInitializer.java | New interface defining the contract for resource ID initializers |
AbstractResourceIdInitializer.java | Abstract base class providing common initialization structure |
ResourceIdInitializerRegistry.java | Registry class managing all database-specific initializers |
*ResourceIdInitializer.java | Database-specific initializer implementations (MySQL, PostgreSQL, Oracle, etc.) |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.../main/java/org/apache/seata/rm/datasource/initializer/db/SqlServerResourceIdInitializer.java
Show resolved
Hide resolved
.../src/main/java/org/apache/seata/rm/datasource/initializer/db/MysqlResourceIdInitializer.java
Outdated
Show resolved
Hide resolved
…tializer/db/MysqlResourceIdInitializer.java Co-authored-by: Copilot <[email protected]>
…tializer/db/SqlServerResourceIdInitializer.java Co-authored-by: Copilot <[email protected]>
Ⅰ. Describe what this PR did
Refactor DataSourceProxy
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews