synchronized 修饰符
https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html
Another way to create synchronized code is with synchronized statements. Unlike synchronized methods, synchronized statements must specify the object that provides the intrinsic lock:
https://www.runoob.com/java/java-modifier-types.html
synchronized 关键字声明的方法同一时间只能被一个线程访问。

浙公网安备 33010602011771号