...
Code Block | ||
---|---|---|
| ||
final Lock lock = new ReentrantLock(); synchronized(lock) { /* ... */ } |
Similarly, it is inappropriate to lock on an object of a class that implements either the Lock
or Condition
interface of package java.util.concurrent.locks
. This problem usually comes up in practice when refactoring from intrinsic locking to the java.util.concurrent
dynamic locking utilities.
...