Skip to content
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

optimize: optimize config compatible module #6403

Merged
merged 11 commits into from
Apr 30, 2024

Conversation

slievrly
Copy link
Member

@slievrly slievrly commented Mar 9, 2024

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

optimize config compatible module

Ⅱ. 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

@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.41%. Comparing base (e72babb) to head (3a90f32).
Report is 8 commits behind head on 2.x.

❗ Current head 3a90f32 differs from pull request most recent head 65406be. Consider uploading reports for the commit 65406be to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6403      +/-   ##
============================================
+ Coverage     50.19%   50.41%   +0.21%     
- Complexity     5232     5252      +20     
============================================
  Files           942      941       -1     
  Lines         33221    33279      +58     
  Branches       4022     4035      +13     
============================================
+ Hits          16676    16777     +101     
+ Misses        14938    14876      -62     
- Partials       1607     1626      +19     
Files Coverage Δ
...rg/apache/seata/core/constants/DubboConstants.java 0.00% <ø> (ø)

... and 48 files with indirect coverage changes

# Conflicts:
#	changes/en-us/2.x.md
#	changes/zh-cn/2.x.md
#	compatible/src/main/java/io/seata/core/context/RootContext.java
# Conflicts:
#	changes/en-us/2.x.md
#	changes/zh-cn/2.x.md
#	compatible/src/main/java/io/seata/core/context/RootContext.java
@slievrly slievrly added this to the 2.1.0 milestone Apr 22, 2024
*
*
*
* Notes: used for io.seata SPI interface
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*/
*/
@Deprecated

*/
public interface ConfigurationProvider extends org.apache.seata.config.ConfigurationProvider {
public interface ConfigurationProvider {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public interface ConfigurationProvider {
@Deprecated
public interface ConfigurationProvider {

*
*/
public interface ExtConfigurationProvider extends org.apache.seata.config.ExtConfigurationProvider {
public enum ConfigurationChangeType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public enum ConfigurationChangeType {
@Deprecated
public enum ConfigurationChangeType {


import org.apache.seata.common.thread.NamedThreadFactory;

public interface ConfigurationChangeListener {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public interface ConfigurationChangeListener {
@Deprecated
public interface ConfigurationChangeListener {

*/
package io.seata.config;

public class ConfigurationChangeEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class ConfigurationChangeEvent {
@Deprecated
public class ConfigurationChangeEvent {

import org.apache.seata.common.util.DurationUtil;
import org.apache.seata.common.util.StringUtils;

public abstract class AbstractConfiguration implements Configuration {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public abstract class AbstractConfiguration implements Configuration {
@Deprecated
public abstract class AbstractConfiguration implements Configuration {

* /apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManager.java
* 2.EnhancedServiceLoader.load(ExtConfigurationProvider.class).provide(configuration)
*/
public class FileConfiguration extends AbstractConfiguration {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class FileConfiguration extends AbstractConfiguration {
@Deprecated
public class FileConfiguration extends AbstractConfiguration {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the conclusions from the previous meeting, Deprecated annotations will be updated uniformly.

} catch (Exception exx) {
LOGGER.error("failed to load non-spring configuration :{}", exx.getMessage(), exx);
}
return ORIGIN_FILE_INSTANCE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不应该返回ORIGIN_FILE_INSTANCE,更应该直接抛出异常提示,可以比较明确的判断问题
Here, instead of returning ORIGIN_FILE_INSTANCE, it would be more appropriate to directly throw an exception with a clear error message, allowing for a more straightforward identification of the issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An exception cannot be thrown here because the file mode does not go through SPI. I've broken down the previous logic a bit and extracted the assignment of default values to the outer logic, but overall, it remains consistent with what was there before.

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly merged commit 4f16097 into apache:2.x Apr 30, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants