O'Reilly logo
  • Dong Yu thinks this is interesting:

Using the Lock interface is similar to using the synchronized keyword: we call the lock() method at the start of the method and call the unlock() method at the end of the method, and we've effectively synchronized the method.


Cover of Java Threads, 3rd Edition


use Lock interface to obtain the same function as synchronized keyword does