herburos
herburos

Reputation: 118

How can I iterate over ConcurrentSkipListMap while preserving weak consistency

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?

Upvotes: 1

Views: 607

Answers (1)

Louis Wasserman
Louis Wasserman

Reputation: 198093

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.

Upvotes: 3

Related Questions