我们来模拟50个线程,每个线程对计数器递增100万次,最终结果应该是5000万。 我们使用4种方式实现,看一下其性能,然后引出为什么需要使用LongAdder、LongAccumulator。 1、方式一:synchronized 方式实现 public class MakeTheCounter { static int count = 0; public static synchroni