如何在保持弱一致性的同时迭代 ConcurrentSkipListMap
How can I iterate over ConcurrentSkipListMap while preserving weak consistency
假设我有多个线程向 ConcurrentSkipListMap
添加条目和从中删除条目。
我有另一个线程在预定义的时间段运行集合并使用 iterator.How 更新它的数据这可以考虑并发访问来完成。
如何迭代?
迭代器是否支持弱一致性?
阅读 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.
假设我有多个线程向 ConcurrentSkipListMap
添加条目和从中删除条目。
我有另一个线程在预定义的时间段运行集合并使用 iterator.How 更新它的数据这可以考虑并发访问来完成。
如何迭代?
迭代器是否支持弱一致性?
阅读 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.