Assume I have multiple threads adding entries to and removing entries from a ConcurrentSkipListMap
.
I have another thread that on predefined periods runs over the collection and update it's data using an iterator.How this can be done considering concurrent access.
how to iterate?
Does the iterator supports weak consistency?
Read the Javadoc:
Iterators are weakly consistent, returning elements reflecting the state of the map at some point at or since the creation of the iterator. They do not throw
ConcurrentModificationException
, and may proceed concurrently with other operations.