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

Java best practices improvements #486

Closed
wants to merge 5 commits into from

Conversation

wdroste
Copy link
Contributor

@wdroste wdroste commented Nov 7, 2022

  • Use AirBase for Maven project (reduce common maven patterns)
  • Add maven wrapper for easier use by community
  • Reduce compile time by removing duplicate compile in test for generated sources
  • Use Immutable/fluent pattern for configuration
  • Upgrade dependencies
  • Migrate from fastjson v1 to v2
  • Use spotless to format the source

@CLAassistant
Copy link

CLAassistant commented Nov 7, 2022

CLA assistant check
All committers have signed the CLA.

@wey-gu wey-gu requested a review from Nicole00 November 7, 2022 07:12
@wdroste
Copy link
Contributor Author

wdroste commented Nov 21, 2022

Uses JDK 11 for AirBase but compiles to JDK 8 target

@@ -88,8 +94,7 @@ public static void main(String[] args) {
NebulaPool pool = new NebulaPool();
Session session;
try {
NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
nebulaPoolConfig.setMaxConnSize(100);
NebulaPoolConfig nebulaPoolConfig = NebulaPoolConfig.builder().maxConnSize(100).build();
Copy link
Contributor

Choose a reason for hiding this comment

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

the change for NebulaPoolConfig may cause Incompatible problem for users, may change the usage in the x version.(x.y.z)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes as a consumer of the lib i thought it was fine since its a compile error, easy to fix and provides for immutablility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO the important parts for this PR is the pom.xml as it upgrades and applys a good standard for the project along w/ spotless which makes the formating easy.

The rest with the configuration is fine either way, but in general it is bad practice to have configuration objects that are mutable. If you can change the configuration while is running that needs to be a feature, but in general I find that it just creates more problems. Its been best practice to make configuration immutable so it can't change in the middle of running it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the mvnw change is great! And the spotless is convenient for contributors. I'am glad to merge your code with mvnw and spotless.
And for the configuration, I totally agree with the way to build a configuration, I use it in connector too. Since it involves changes on the user side, it needs to be confirmed with pd.

Copy link
Contributor

Choose a reason for hiding this comment

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

So could you please split the configuration part to another pr? Then we can merge the mvnw and spotless first.

Choose a reason for hiding this comment

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

Thanks for your pr. But I suggest postponing to the next x version to avoid incompatibility.

@QingZ11
Copy link

QingZ11 commented Feb 24, 2023

@wdroste hi, based on a commit in your code contribution, @Nicole00 submitted a pr #513, and the rest of the commit does not match our plan, can you please close this pr?

By the way, would you like to be the reviewer of this pr?

@wdroste wdroste closed this Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants