-
Bug
-
Resolution: Fixed
-
P3
-
5.0u4
-
b51
-
x86
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2132672 | 5.0u8 | Praveen G | P3 | Closed | Won't Fix |
This bug is present on both Solaris and Windows, cu env requires fixes for both.
The javadocs for java.util.concurrent.locks.ReentrantReadWriteLock say
this about acquisition order when there is a reader currently holding
the lock (the last sentance in the paragraph on Acquisition Order): In
either case, if readers are active and a writer enters the lock then no
subsequent readers will be granted the read lock until after that writer
has acquired and released the write lock.
However, my test case doesn't behave this way. What happens with a
non-fair ReentrantReadWriteLock, is that a thread gets the read lock.
Then, another thread gets enqueued to acquire the exclusive write lock.
So far so good. Now if you ask another thread to acquire the read lock,
it barges in front of the thread waiting for the write lock and acquires
a read lock.
According to the javadocs, this shouldn't have happened. The docs say
that the third thread is supposed to wait until after the write lock has
acquired and then released its write lock before this newly enqueued
reader should get to have the lock.
###@###.### 2005-07-07 22:38:59 GMT
The javadocs for java.util.concurrent.locks.ReentrantReadWriteLock say
this about acquisition order when there is a reader currently holding
the lock (the last sentance in the paragraph on Acquisition Order): In
either case, if readers are active and a writer enters the lock then no
subsequent readers will be granted the read lock until after that writer
has acquired and released the write lock.
However, my test case doesn't behave this way. What happens with a
non-fair ReentrantReadWriteLock, is that a thread gets the read lock.
Then, another thread gets enqueued to acquire the exclusive write lock.
So far so good. Now if you ask another thread to acquire the read lock,
it barges in front of the thread waiting for the write lock and acquires
a read lock.
According to the javadocs, this shouldn't have happened. The docs say
that the third thread is supposed to wait until after the write lock has
acquired and then released its write lock before this newly enqueued
reader should get to have the lock.
###@###.### 2005-07-07 22:38:59 GMT
- backported by
-
JDK-2132672 java.util.concurrent.locks.ReentrantReadWriteLock acquisition order
-
- Closed
-
- relates to
-
JDK-6281487 ReentrantReadWriteLock: readers repeatedly acquire lock while writer is waiting
-
- Resolved
-
-
JDK-6305337 Reentrant writeLock in Fair mode ReentrantReadWriteLock may block
-
- Closed
-
-
JDK-6207928 ReentrantReadWriteLock provides no way to tell if current thread holds read lock
-
- Resolved
-