The java.
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 java.
.
The java.
interface
similarly defines locks that may be shared among readers but are
exclusive to writers. Only a single implementation, java.
, is provided, since
it covers most standard usage contexts. But programmers may create
their own implementations to cover nonstandard requirements.
The java.
interface
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
names of Condition
methods are different from the
corresponding Object
versions.
The java.
class serves as a useful superclass for defining locks and other
synchronizers that rely on queuing blocked threads. The java.
class
provides the same functionality but extends support to 64 bits of
synchronization state. Both extend class java.
, a simple
class that helps record the thread currently holding exclusive
synchronization. The java.
class provides lower-level blocking and unblocking support that is
useful for those developers implementing their own customized lock
classes.
Modifier and Type | Interface and Description |
---|---|
public interface | |
public interface | Lock
|
public interface | ReadWriteLock
A |
Modifier and Type | Class and Description |
---|---|
public abstract class | AbstractOwnableSynchronizer
A synchronizer that may be exclusively owned by a thread. |
public abstract class | AbstractQueuedLongSynchronizer
A version of |
public abstract class | AbstractQueuedSynchronizer
Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues. |
public class | LockSupport
Basic thread blocking primitives for creating locks and other synchronization classes. |
public class | ReentrantLock
A reentrant mutual exclusion |
public class | ReentrantReadWriteLock
An implementation of |
public class | StampedLock
A capability-based lock with three modes for controlling read/write access. |