iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
88.23k stars 26.18k forks source link

fix: Version number pattern update overwritten #2968 #2980

Closed Avinash2110 closed 4 weeks ago

Avinash2110 commented 4 weeks ago

What problem does this PR solve?

Currently the version number pattern is not thread safe in case multiple updates are done at the same time. To resolve this I have used ConcurrentHashMap and written the critical code inside the synchronized block with a lock to avoid dirty read and overwriting.

sonarcloud[bot] commented 4 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

iluwatar commented 4 weeks ago

Looks good! Thank you for the contribution 🎉

@all-contributors please add @Avinash2110 for code

allcontributors[bot] commented 4 weeks ago

@iluwatar

I couldn't determine any contributions to add, did you specify any contributions? Please make sure to use valid contribution names.

I've put up a pull request to add @Avinash2110! :tada: