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

added try catch in computeifpresent to preserve old value incase of e… #5896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asureshraja
Copy link

@asureshraja asureshraja commented Jan 25, 2022

added try catch in computeifpresent to preserve old value incase of errors
Issue 5438 - #5438

}
return function.apply(k, oldValue);
}catch (Throwable e){
this.put(k,oldValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit sketchy, e.g. ConcurrentHashMap does not allow writes within a computation. I think it would be better to handle this within the compute method, even if a more complex method to understand.

@ben-manes
Copy link
Contributor

Ideally fix the formatting to Google's style guide, but maybe if merged that person will do it.

You might want to run Caffeine's test suite against your new dependency. You can use jitpack.io or a file dependency, and update the non-atomic computes from GuavaCacheFromContext. It runs many tests to 1-2hrs if the full suite.

@netdpb netdpb added P3 package=cache type=defect Bug, not working as expected labels Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 package=cache type=defect Bug, not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants