When one thread is executing a synchronized block, any thread waiting to enter that block is stalled.
当一个线程正在执行一个同步块时,任何等待进入该块的线程都将被阻塞。
Under those conditions the values in the synchronized block will never be contended for.
在这种条件下,同步块中的值永远不会存在竞争。
In cases where synchronization is necessary, the synchronized code block should be minimized.
在有必要进行同步的场合下,应该尽量缩小同步代码块。
应用推荐