Skip to content

HDDS-14955. Simplify BigInteger instantiation for improved efficiency.#10035

Merged
adoroszlai merged 3 commits intoapache:masterfrom
ptlrs:HDDS-14955-Improve-BigInteger-instantiation
Apr 13, 2026
Merged

HDDS-14955. Simplify BigInteger instantiation for improved efficiency.#10035
adoroszlai merged 3 commits intoapache:masterfrom
ptlrs:HDDS-14955-Improve-BigInteger-instantiation

Conversation

@ptlrs
Copy link
Copy Markdown
Contributor

@ptlrs ptlrs commented Apr 3, 2026

What changes were proposed in this pull request?

This PR:

  1. Enables BigIntegerInstantiation PMD rule to avoid creating instances of already existing BigInteger
  2. Avoids unnecessary boxing. Use BigInteger.valueOf(<String/primitive>) where possible
  3. Avoids eager instantiation

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14955

How was this patch tested?

CI: https://github.com/ptlrs/ozone/actions/runs/23931631050

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @ptlrs for the patch. There is one more occurrence with eager instantiation (as linked in the task description). The rest LGTM.

private synchronized void updateCachedSubCAId(String s) {
BigInteger candidateNewId = new BigInteger(s);
if (caCertId == null
|| new BigInteger(caCertId).compareTo(candidateNewId) < 0) {

@adoroszlai adoroszlai marked this pull request as ready for review April 13, 2026 15:19
@adoroszlai adoroszlai merged commit 584bb6a into apache:master Apr 13, 2026
57 of 59 checks passed
@ptlrs ptlrs deleted the HDDS-14955-Improve-BigInteger-instantiation branch April 13, 2026 19:00
@ptlrs
Copy link
Copy Markdown
Contributor Author

ptlrs commented Apr 13, 2026

Thanks for updating the PR and the reviews @adoroszlai

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.

2 participants