Concurrency: Understanding the Value of Read-Write Locks
New locking mechanisms were introduced in Java 5. I have discussed the concurrency utilities introduced in Java 5 many times before:
Concurrency: Executors - http://www.javalobby.org/forums/thread.jspa?messageID=91820706�
Concurrency: Blocking Queues and You - http://www.javalobby.org/java/forums/m91820807.html
Concurrency: Ensure Thread Safety On Single Values With Atomic Variables - http://www.javalobby.org/java/forums/m91839242.html
Concurrency: I Can See Into Your Future - http://www.javalobby.org/forums/thread.jspa?messageID=91836328
One of the packages introduced with this feature set was the java.util.concurrent.locks
library. This package is actually quite small, and really only contains two interfaces that the average user would be interested in: the java.util.concurrent.locks.Lock
and the java.util.concurrent.locks.ReadWriteLock
. I want to discuss read-write locks in more detail, but first let me re-hash regular locks.
The idea behind the Lock
interface is to provide a standard API for locking around a resource without forcing a particular implementation. For the most part, locks are direct in comparison to pre-Java 5 synchronization:
Read full article from Concurrency: Understanding the Value of Read-Write Locks
No comments:
Post a Comment