File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Can we use  ReentrantReadWriteLock ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Can we use  ReentrantReadWriteLock ?" Watch "Can we use  ReentrantReadWriteLock ?" New topic

Can we use ReentrantReadWriteLock ?

james bonds

Joined: Feb 19, 2007
Posts: 9
ReadWriteLock was added after J2SE 1.5.
If I use the latest version(J2Se1.6), then may I use ReadWriteLock of java.util.concurrent.locks ?
Of cource, I never use it in Lock/Unlock Method.

I want to use it in read/update/create/delete.
[ February 21, 2007: Message edited by: james bonds ]
David A. Scott
Ranch Hand

Joined: Apr 13, 2006
Posts: 55

it's part of the standard API so yes.

Why can't you use it in lock/unlock?

Vincent Li

Joined: Jan 12, 2007
Posts: 22
ReadWriteLock and all the concurrent lock stuff were added in 5.0, not 6.0, so yes, that's perfectly valid.

-- Vince
SCJP(1.4), SCWCD(1.4), SCJD(almost there!)

Vince<br />SCJP(1.4), SCWCD(1.4), SCJD (5.0)
Maciej Miklas
Ranch Hand

Joined: Feb 12, 2007
Posts: 61
sure. I am using it - it is easy and nice
This is also very easy to keep trace of threads waiting for the particular row.
I agree. Here's the link:
subject: Can we use ReentrantReadWriteLock ?
It's not a secret anymore!