|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.lock.Lock<K>
K - the type of keyfinal class Lock<K>
A class used to represent locks.
Callers should only call non-Object methods on instances of this
class if they hold the lock on the key map associated with the instance.
LockManager| Field Summary | |
|---|---|
(package private) K |
key
The key that identifies this lock. |
| Constructor Summary | |
|---|---|
Lock(K key)
Creates a lock. |
|
| Method Summary | ||
|---|---|---|
(package private) static
|
checkNoSync(LockManager<K> lockManager)
Checks that the current thread is not synchronized on the map associated with a key, throwing AssertionError if it is, and
otherwise returning true. |
|
(package private) boolean |
checkSync(LockManager<K> lockManager)
Checks that the current thread is synchronized on the map associated with this lock, throwing AssertionError if it is not, and
otherwise returning true. |
|
(package private) List<LockRequest<K>> |
copyOwners(LockManager<K> lockManager)
Returns a possibly read-only copy of the lock requests for the owners. |
|
(package private) List<LockRequest<K>> |
copyWaiters(LockManager<K> lockManager)
Returns a possibly read-only copy of the lock requests for the waiters. |
|
(package private) void |
flushWaiter(Locker<K> locker)
Removes a locker from the list of waiters for this lock. |
|
(package private) boolean |
inUse(LockManager<K> lockManager)
Returns whether this lock is currently in use, or whether it is not in use and can be removed from the lock table. |
|
(package private) boolean |
isOwner(LockRequest<K> request)
Checks if the lock is already owned in a way the satisfies the specified request. |
|
(package private) LockAttemptResult<K> |
lock(Locker<K> locker,
boolean forWrite,
boolean waiting)
Attempts to obtain this lock. |
|
(package private) static
|
noteSync(LockManager<K> lockManager,
K key)
Notes the start of synchronization on the map associated with key. |
|
(package private) static
|
noteUnsync(LockManager<K> lockManager,
K key)
Notes the end of synchronization on the map associated with key. |
|
(package private) List<Locker<K>> |
release(Locker<K> locker,
boolean downgrade)
Releases the ownership of this lock by the locker. |
|
String |
toString()
Print fields, for debugging. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
final K key
| Constructor Detail |
|---|
Lock(K key)
key - the key that identifies this lock| Method Detail |
|---|
LockAttemptResult<K> lock(Locker<K> locker,
boolean forWrite,
boolean waiting)
waiting is true, the
locker is known to be waiting for the lock, although it may also be
waiting otherwise. Adds the locker as an owner of the lock if the lock
was obtained, and removes the locker from the waiters list if it was
waiting. Returns null if the locker already owned this lock.
Otherwise, adds the locker to the waiters list, and returns a LockAttemptResult containing the LockRequest, with its conflict field set to null if the lock was acquired or a
conflicting transaction if the lock could not be obtained.
locker - the locker requesting the lockforWrite - whether a write lock is requestedwaiting - whether the locker is known to be a waiter
LockAttemptResult or null
List<Locker<K>> release(Locker<K> locker,
boolean downgrade)
locker - the locker whose ownership will be releaseddowngrade - whether to downgrade ownership from write to read
rather than releasing all ownership
boolean inUse(LockManager<K> lockManager)
List<LockRequest<K>> copyOwners(LockManager<K> lockManager)
List<LockRequest<K>> copyWaiters(LockManager<K> lockManager)
void flushWaiter(Locker<K> locker)
boolean isOwner(LockRequest<K> request)
static <K> boolean noteSync(LockManager<K> lockManager,
K key)
key. Throws AssertionError if already synchronized on a
key, otherwise returns true.
static <K> boolean noteUnsync(LockManager<K> lockManager,
K key)
key. Throws AssertionError if not already synchronized on
key, otherwise returns true.
static <K> boolean checkNoSync(LockManager<K> lockManager)
AssertionError if it is, and
otherwise returning true.
boolean checkSync(LockManager<K> lockManager)
AssertionError if it is not, and
otherwise returning true.
public String toString()
toString in class Object
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||