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

CacheEntryProcessorEntry exists() inconsistent behaviour #11266

Closed
MichelePaterniti opened this issue Aug 31, 2017 · 1 comment
Closed

CacheEntryProcessorEntry exists() inconsistent behaviour #11266

MichelePaterniti opened this issue Aug 31, 2017 · 1 comment

Comments

@MichelePaterniti
Copy link

@MichelePaterniti MichelePaterniti commented Aug 31, 2017

Suppose a MutableEntry<K, T> entry exists.

System.out.println( entry.exists() ); // prints out true
System.out.println( entry.getValue() ); // prints out the objects toString
System.out.println( entry.exists() ); // prints out false 

I would expect the second entry.exists() invocation would return true, since the entry was not removed.

jerrinot added a commit to jerrinot/hazelcast that referenced this issue Aug 31, 2017
Reasoning:
1. getValue() changes state from NONE to ACCESS.
2. When an entry is not in the NONE state then exists() method
   assumes the value exists if and only if it's already set in the
   value field -> we have to store the value on transition

Fixes hazelcast#11266
@jerrinot jerrinot added this to the 3.9 milestone Aug 31, 2017
@jerrinot jerrinot added the Team: Core label Aug 31, 2017
@jerrinot
Copy link
Contributor

@jerrinot jerrinot commented Aug 31, 2017

@MichelePaterniti: thanks for your report. I can confirm it's indeed a bug.

jerrinot added a commit to jerrinot/hazelcast that referenced this issue Aug 31, 2017
Reasoning:
1. getValue() changes state from NONE to ACCESS.
2. When an entry is not in the NONE state then exists() method
   assumes the value exists if and only if it's already set in the
   value field -> we have to store the value on transition

Fixes hazelcast#11266
jerrinot added a commit to jerrinot/hazelcast that referenced this issue Sep 5, 2017
Reasoning:
1. getValue() changes state from NONE to ACCESS.
2. When an entry is not in the NONE state then exists() method
   assumes the value exists if and only if it's already set in the
   value field -> we have to store the value on transition

Fixes hazelcast#11266

(cherry picked from commit 36036db)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.