Individual fields cannot be marked as synchronized.
单独的成员变量是不能被标明为同步的。
So look, consider taking the advice when a small community accidentally comes together as synchronized advisors.
所以听着,试着接受这个建议当一个小团体给出的答案都偶然相同就像同步顾问一样。
The ReentrantLock class, which implements Lock, has the same concurrency and memory semantics as synchronized, but also adds features like lock polling, timed lock waits, and interruptible lock waits.
ReentrantLock 类实现了 Lock ,它拥有与 synchronized 相同的并发性和内存语义,但是添加了类似锁投票、定时锁等候和可中断锁等候的一些特性。
应用推荐