public final class SimpleLock
extends java.lang.Object
SimpleLock
is a simple implementation of an
exclusive lock. It does not support nested lock/unlock pairs from
the same thread. It does not guarantee fairness. It does not
detect thread abandonment (i.e. thread exits while holding lock.)
It does not verify that a thread actually holds the lock when it
tries to unlock the lock. Constructor and Description |
---|
SimpleLock()
Construct a new
SimpleLock instance. |
public SimpleLock()
SimpleLock
instance. The lock
is created in the unlocked state by default.public void lock()
public void unlock()
public boolean isLocked()