[
https://jira.jboss.org/browse/ISPN-536?page=com.atlassian.jira.plugin.sys...
]
Nicolas Filotto updated ISPN-536:
---------------------------------
Description:
I'm totally aware that the cache size is an approximation according to your doc
however the value could be improved if in the class DefaultDataContainer in case of cache
entry expiration, you first check if the method remove(key) returns a non null value
before decrementing the variable numEntries as below otherwise you could decrement it
several times for the same entry:
{code}`
if (mortalEntries.remove(k) != null) {
numEntries.getAndDecrement();
}
{code}
I attached a test case in which I set maxIdle to 0 to make the issue happens more easily.
I also attached a patch proposal, it is up to you to apply it or reject it.
was:
I'm totally aware that the cache size is an approximation according to your doc
however the value could be improved if in the class DefaultDataContainer in case of the
cache expiration, you first check if the method remove(key) returns a non null value
before decrementing the variable numEntries as below otherwise you could decrement it
several times for the same entry:
{code}`
if (mortalEntries.remove(k) != null) {
numEntries.getAndDecrement();
}
{code}
I attached a test case in which I set maxIdle to 0 to make the issue happens more easily.
I also attached a patch proposal, it is up to you to apply it or reject it.
The size of a local cache could be more accurate under concurrent
modifications when expiration is enabled
----------------------------------------------------------------------------------------------------------
Key: ISPN-536
URL:
https://jira.jboss.org/browse/ISPN-536
Project: Infinispan
Issue Type: Feature Request
Affects Versions: 4.0.0.Final, 4.1.0.CR1
Reporter: Nicolas Filotto
Assignee: Manik Surtani
Fix For: 4.1.0.CR2
Attachments: ISPN-536.diff, TestCacheSize.java, TestCacheSize.java
I'm totally aware that the cache size is an approximation according to your doc
however the value could be improved if in the class DefaultDataContainer in case of cache
entry expiration, you first check if the method remove(key) returns a non null value
before decrementing the variable numEntries as below otherwise you could decrement it
several times for the same entry:
{code}`
if (mortalEntries.remove(k) != null) {
numEntries.getAndDecrement();
}
{code}
I attached a test case in which I set maxIdle to 0 to make the issue happens more easily.
I also attached a patch proposal, it is up to you to apply it or reject it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira