The 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
is Lock.
ReentrantLock
The interface
similarly defines locks that may be shared among readers but are
exclusive to writers. Only a single implementation, ReadWriteLock, is provided, since
it covers most standard usage contexts. But programmers may create
their own implementations to cover nonstandard requirements.
ReentrantReadWriteLock
The interface
describes condition variables that may be associated with Locks.
These are similar in usage to the implicit monitors accessed using
ConditionObject.wait, but offer extended capabilities.
In particular, multiple Condition objects may be associated
with a single Lock. To avoid compatibility issues, the
names of Condition methods are different from the
corresponding Object versions.
The
class serves as a useful superclass for defining locks and other
synchronizers that rely on queuing blocked threads. The AbstractQueuedSynchronizer class
provides the same functionality but extends support to 64 bits of
synchronization state. Both extend class AbstractQueuedLongSynchronizer, a simple
class that helps record the thread currently holding exclusive
synchronization. The AbstractOwnableSynchronizer
class provides lower-level blocking and unblocking support that is
useful for those developers implementing their own customized lock
classes.
LockSupport