public class LockManager extends Object
Constructor and Description |
---|
LockManager()
Create a new set of locks.
|
LockManager(boolean trackLocks)
Creates a new set of locks, optionally with lock tracking enabled.
|
LockManager(boolean trackLocks,
int collectionFrequency)
Creates a new set of locks, optionally with lock tracking enabled.
|
Modifier and Type | Method and Description |
---|---|
Lock |
createLock(String alias)
Creates a new active lock.
|
boolean |
isActiveLock()
If any locks in this collection that are still active.
|
void |
waitForActiveLocks()
Blocks current thread until the number of active locks has reached zero.
|
public LockManager()
public LockManager(boolean trackLocks)
trackLocks
- Controls whether to keep a stack trace of active locks. Enabling
lock tracking will add some overhead, but can be very useful for
debugging.public LockManager(boolean trackLocks, int collectionFrequency)
trackLocks
- Controls whether to keep a stack trace of active locks. Enabling
lock tracking will add some overhead, but can be very useful for
debugging.collectionFrequency
- Number of milliseconds to block the first thread, waiting for
active locks to finish, before running the memory garbage
collection, to free abandoned active locks.public boolean isActiveLock()
true
of one or more locks that have not be released.public void waitForActiveLocks() throws InterruptedException
InterruptedException
- if any thread interrupted the current thread before or while the
current thread was waiting for a notification. The interrupted
status of the current thread is cleared when this exception is
thrown.public Lock createLock(String alias)
Lock.release()
method is called, which decreases the number of
active locks by the same amount.alias
- a short string used to log abandon locksCopyright © 2001-2016 Aduna. All Rights Reserved.