Lock interface supports
locking disciplines that differ in semantics (reentrant, fair, etc),
and that can be used in non-block-structured contexts including
hand-over-hand and lock reordering algorithms. The main implementation
similarly defines locks that may be shared among readers but are
exclusive to writers. Only a single implementation,
ReentrantReadWriteLock, is provided, since
it covers most standard usage contexts. But programmers may create
their own implementations to cover nonstandard requirements.
describes condition variables that may be associated with Locks.
These are similar in usage to the implicit monitors accessed using
Object.wait, but offer extended capabilities.
In particular, multiple
Condition objects may be associated
with a single
Lock. To avoid compatibility issues, the
Condition methods are different from the
class serves as a useful superclass for defining locks and other
synchronizers that rely on queuing blocked threads. The
provides the same functionality but extends support to 64 bits of
synchronization state. Both extend class
AbstractOwnableSynchronizer, a simple
class that helps record the thread currently holding exclusive
class provides lower-level blocking and unblocking support that is
useful for those developers implementing their own customized lock
Lockimplementations provide more extensive locking operations than can be obtained using
synchronizedmethods and statements.A
ReadWriteLockmaintains a pair of associated
locks, one for read-only operations and one for writing.
ClassDescriptionA synchronizer that may be exclusively owned by a thread.A version of
AbstractQueuedSynchronizerin which synchronization state is maintained as a
long.Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues.Basic thread blocking primitives for creating locks and other synchronization classes.A reentrant mutual exclusion
Lockwith the same basic behavior and semantics as the implicit monitor lock accessed using
synchronizedmethods and statements, but with extended capabilities.The lock returned by method
ReentrantReadWriteLock.readLock().The lock returned by method
ReentrantReadWriteLock.writeLock().A capability-based lock with three modes for controlling read/write access.