views:

97

answers:

2

Just to be sure, can experts confirm that

java.util.concurrent.locks.Lock

and Doug Lea's original Sync

are basically the same thing but with different names.

  • acquire vs lock
  • release vs unlock

Thanks.

A: 

For what it is worth, the source code for java.util.concurrent.locks.Lock lists Doug Lea as its author. Same goes for many other files in that package.

   /*
    * This file is available under and governed by the GNU General Public
    * License version 2 only, as published by the Free Software Foundation.
    * However, the following notice accompanied the original version of this
    * file:
    *
    * Written by Doug Lea with assistance from members of JCP JSR-166
    * Expert Group and released to the public domain, as explained at
    * http://creativecommons.org/licenses/publicdomain
    */
Thilo
Yes I know that. But from a conceptual point of view, can they be regarded equivalent ?
Jacques René Mesrine
+1  A: 

A ReentrantLock which implements Lock wraps a class called Sync. All were written by Doug Lea. I suggest you try to use the libraries in Java.

Peter Lawrey