java.util.concurrent.CopyOnWriteArrayList
get时未使用lock,返回对象数组下标对应值。
修改操作ReentrantLock加锁,操作的对象实为System.arraycopy后生成的对象,然后把此对象引用赋值给CopyOnWriteArrayList中的对象数组。
内存一致性:插入操作会在读和删除操作之前进行。
iterator()方法生成的为快照,不支持修改操作。
关于内存一致性的说明:
Memory consistency effects: As with other concurrent
collections, actions in a thread prior to placing an object into a
CopyOnWriteArrayList happen-before actions subsequent to the access or removal of that element from the CopyOnWriteArrayList in another thread.