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

Objects with multi-threaded access should not lazily populate a hash field [SPR-11428] #16054

spring-projects-issues opened this issue Feb 14, 2014 · 0 comments


Copy link

@spring-projects-issues spring-projects-issues commented Feb 14, 2014

Juergen Hoeller opened SPR-11428 and commented

MethodParameter, RequestMappingInfo and SimpMessageMappingInfo currently cache a lazily calculated hash value in a regular int field. This should be avoided since instances of those classes can be used as keys in caches with multi-threaded access, exposing an incomplete visibility risk for non-volatile fields.

Instead of going with volatile or synchronized, let's rather not cache those hash values to begin with but rather design simple, cheap enough hashCode() implementations that always calculate on the fly.

Affects: 3.2.7, 4.0.1

Backported to: 3.2.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants