[concurrency-interest] Creating custom locks

Doug Lea dl@cs.oswego.edu
Wed, 19 Nov 2003 20:38:17 -0500


> But the lock classes aren't vary user freindly. Please change this, if security is a concern then create a level of abstract classes and make the others final. Example: 
> 
> public class ReentrantLock implements Lock, java.io.Serializable {
> ... other stuff
> 
>     final void checkOwner(Thread t) { //why final

Hi Luis,

Thanks for the prod. ReentrantLock and ReeentrantReadWriteLock are in
fact slated to be refactored to share most of the common code that got
duplicated when I improved and added instrumentation to them last
month.  I'll aim for a friendlier design. For example, some shared
functionality may be put into a class nested inside LockSupport,
making it possible to reuse for other kinds of locks.  I'm not sure
when this will happen though. At this point, it seems unlikely to be
ready for 1.5 beta1.

-Doug