AtomicIntegerFieldUpdater和AtomicInteger

为什么有了AtomicInteger还需要AtomicIntegerFieldUpdater?

当需要进行原子限定的属性所属的类会被创建大量的实例对象, 如果用AtomicInteger, 每个实例里面都要创建AtomicInteger对象, 从而多出内存消耗.显然是不合适的。

因此出现了AtomicIntegerFieldUpdater(原子字段更新器),仅需要在抽象的父类中声明一个静态的更新器,就可以在各个对象中使用了。

原文地址:https://www.cnblogs.com/chen--biao/p/11337243.html