While no one would ever directly use the idiom in Listing 1, this code is very similar to the case where the lock associated with a synchronized block can be proven to be a thread-local variable.
虽然没有人会直接使用清单1中的形式,但是与这个代码非常类似的情况是:可以证实与synchronized块关联的锁是一个线程本地变量。
Another special case of locking is the need to lock something where currently no database row exists.
锁定的另一个特例是需要锁定当前数据库行中不存在的项目。
In that case, the optimal pricing strategy is to charge as much in the beginning or to lock in customers with long-term contracts.
在这种情况下,最佳定价策略应该是:在初始阶段尽可能地抬高定价或是和顾客签订长期合约。
应用推荐