When a thread invokes a synchronized method, it automatically acquires the intrinsic lock for that method's object and releases it when the method returns.
当一个线程调用一个同步方法时,它自动请求此方法的内部锁,并在方法返回时释放。
Similarly, attempting to acquire an intrinsic lock (enter a synchronized block) cannot be interrupted, but ReentrantLock supports an interruptible acquisition mode.
类似地,尝试获取一个内部锁的操作(进入一个synchronized块)是不能被中断的,但是ReentrantLock支持可中断的获取模式。
An object's intrinsic lock and its intrinsic condition queue are related: in order to call any of the condition queue methods on object X, you must hold the lock on X .
一个对象的固有锁和它的固有条件队列是相关的,为了调用对象X内条件队列的方法,你必须获得对象X的锁。 这是因为等待状态条件的机制和保证状态连续性的机制是紧密的结合在一起的。
应用推荐