]
Nicolas Filotto updated ISPN-536:
---------------------------------
Attachment: TestCacheSize.java
ISPN-536.diff
The cache 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
Attachments: ISPN-536.diff, 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 the cache
entry is expired, 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: