-
1. Re: Is calling iterator.remove() on a replicated cache supported by Infinispan?
william.burns Apr 7, 2015 8:13 AM (in response to mmr11408)The iterator remove method is not supported on keySet, values, or entrySet collections until version 7.0. The reason for this is because in versions prior to 7.0 the collection these methods returned were just shallow copies and thus we didn't allow modifications to them. In 7.0 the collections returned are fully backed by the cache so updates are reflected in the other and vice versa. See [1]
If you want to remove an entry while iterating on it in 6.0, you can just call Cache.remove(Object key) method to remove the entry while iterating on the cache. This won't throw a ConcurrentModificationException since the cache is a concurrent collection implementation.
I wonder though you say
Mehdi Rakhshani wrote:
app2 is periodically processing the cache entries in the order they were added to the
cache and removing them.The iterator does not return the entries in any specific order and could even change between invocations. I am guessing you must be doing this ordering in your application somehow ?
[1] Infinispan: Why doesn't Map.size return the size of the entire cluster?
-
2. Re: Is calling iterator.remove() on a replicated cache supported by Infinispan?
mmr11408 Apr 8, 2015 6:47 AM (in response to william.burns)Thanks for the reply. I ended up changing the design to not use the iterator.remove() and instead use cache.remove( key ) and to not rely on the order. I have put off upgrading to 7.x until hopefully more documentation on how to convert the configuration file is provided.