Skip to content

ConcurrentReferenceHashMap does not enforce visibility of cached EntrySet [SPR-16994] #21532

Closed
@spring-projects-issues

Description

@spring-projects-issues

Juergen Hoeller opened SPR-16994 and commented

ConcurrentReferenceHashMap.entrySet() tries to reuse a cached EntrySet instance but stores it in a regular field which doesn't guarantee visibility to other threads. Operating against a volatile field is the cleaner arrangement here.

Also, ConcurrentReferenceHashMap does not implement isEmpty(), relying on AbstractMap's computation of the full size. This can be optimized by simply backing out once a non-empty hash segment has been found.


Affects: 4.3.18, 5.0.7

Issue Links:

Referenced from: commits 44b2657, ce0323f, 779cf8d

Backported to: 4.3.19

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions