[
https://issues.apache.org/jira/browse/IGNITE-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14958575#comment-14958575
]
Roman Shtykh commented on IGNITE-512:
-------------------------------------
Is it fixed or are there any special configurations to reproduce it?
Checking the 2nd case (below) does not reveal any problem.
{code}
for (int i = 0; i < 100; i++)
cache.put(i, Integer.toString(i));
cache.removeAll();
for (int i = 0; i < 10000; i++) {
Cache.Entry<Integer, String> e = cache.randomEntry();
if (e != null)
throw new IllegalStateException();
}
{code}
> IgniteCache.randomEntry() is implemented incorrectly.
> -----------------------------------------------------
>
> Key: IGNITE-512
> URL: https://issues.apache.org/jira/browse/IGNITE-512
> Project: Ignite
> Issue Type: Bug
> Components: cache
> Affects Versions: sprint-1
> Reporter: Vladimir Ozerov
>
> 1) It may return null if randomly picked entry is obsolete, which violates
> method semantics described in JavaDocs: it should return null ony in case
> cache is empty.
> 2) It may return not-null for empty cache. E.g., put several falues to it,
> then call removeAll(), then call randomEntry() - you may got value even after
> removal. Looks like "isObsolete" check is not enough.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)