-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
7u151, 8u144, 9
The API documentation for lock(), tryLock() and lockInterruptibly​() methods of ReentrantReadWriteLock.WriteLock states that the write lock can not be acquired if the read lock is held by another thread. Instead it should clearly state that the write lock can not be acquired even if the read lock is held by the current thread.
https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.WriteLock.html#tryLock--
This point is clarified in the 'Reentrancy' section of this page:
https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html
"Additionally, a writer can acquire the read lock, but not vice-versa. Among other applications, reentrancy can be useful when write locks are held during calls or callbacks to methods that perform reads under read locks. If a reader tries to acquire the write lock it will never succeed. "
https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.WriteLock.html#tryLock--
This point is clarified in the 'Reentrancy' section of this page:
https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html
"Additionally, a writer can acquire the read lock, but not vice-versa. Among other applications, reentrancy can be useful when write locks are held during calls or callbacks to methods that perform reads under read locks. If a reader tries to acquire the write lock it will never succeed. "
- links to
-
Review(master) openjdk/jdk/25880