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

JCacheCache#putIfAbsent is not atomic #21591

Closed
spring-projects-issues opened this issue Jul 17, 2018 · 0 comments
Closed

JCacheCache#putIfAbsent is not atomic #21591

spring-projects-issues opened this issue Jul 17, 2018 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Jens Wilke opened SPR-17053 and commented

The implementation of Cache.putIfAbsent for JCache is not atomic as the methods contract requires.

@Override
public ValueWrapper putIfAbsent(Object key, Object value) {
 boolean set = this.cache.putIfAbsent(key, toStoreValue(value));
 return (set ? null : get(key));
}

The semantic could be implemented correctly via the Cache.invoke and the EntryProcessor. If okay I can do an PR.

This is only a very minor issue. So far I can see putIfAbsent is actually not used.


Affects: 5.0.7

@spring-projects-issues spring-projects-issues added type: bug A general bug status: waiting-for-triage An issue we've not yet triaged or decided on in: core Issues in core modules (aop, beans, core, context, expression) and removed type: bug A general bug labels Jan 11, 2019
@snicoll snicoll changed the title putIfAbsent not atomic in JCache implementation [SPR-17053] JCacheCache#putIfAbsent is not atomic Sep 18, 2023
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 18, 2023
@snicoll snicoll added this to the 6.1.0-RC1 milestone Sep 18, 2023
@snicoll snicoll self-assigned this Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants