|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.lock.Locker<K>
K - the type of keypublic abstract class Locker<K>
Records information about an entity that requests locks from a LockManager.
| Field Summary | |
|---|---|
(package private) LockManager<K> |
lockManager
The lock manager for this locker. |
| Constructor Summary | |
|---|---|
protected |
Locker(LockManager<K> lockManager)
Creates an instance of this class. |
| Method Summary | |
|---|---|
(package private) boolean |
checkAllowSync()
Checks that the current thread is permitted to synchronize on this locker. |
protected void |
clearConflict()
Clears the conflict that should cause this locker's current request to be denied. |
protected LockConflict<K> |
getConflict()
Checks if there is a conflict that should cause this locker's current request to be denied. |
LockManager<K> |
getLockManager()
Returns the lock manager for this locker. |
protected long |
getLockTimeoutTime(long now,
long lockTimeout)
Returns the time when a lock attempt should stop, given the current time and the lock timeout supplied by the caller. |
(package private) abstract LockAttemptResult<K> |
getWaitingFor()
Checks if this locker is waiting for a lock. |
protected LockRequest<K> |
newLockRequest(K key,
boolean forWrite,
boolean upgrade)
Creates a new lock request. |
(package private) boolean |
noteSync()
Notes the start of synchronization on this locker. |
(package private) boolean |
noteUnsync()
Notes the end of synchronization on this locker. |
(package private) abstract void |
setWaitingFor(LockAttemptResult<K> waitingFor)
Records that this locker is waiting for a lock, or marks that it is not waiting if the argument is null. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
final LockManager<K> lockManager
| Constructor Detail |
|---|
protected Locker(LockManager<K> lockManager)
lockManager - the lock manager for this locker| Method Detail |
|---|
public LockManager<K> getLockManager()
protected long getLockTimeoutTime(long now,
long lockTimeout)
now - the current time in millisecondslockTimeout - the amount of time in milliseconds to wait for a
lock
protected LockRequest<K> newLockRequest(K key,
boolean forWrite,
boolean upgrade)
The default implementation creates and returns an instance of LockRequest.
key - the key that identifies the lockforWrite - whether the request is for writeupgrade - whether the request is for an upgrade
protected LockConflict<K> getConflict()
null if there was no
conflict.
The default implementation of this method always returns null.
nullprotected void clearConflict()
null return
value from getConflict with a type field
equal to DEADLOCK, then the conflict
cannot be cleared and IllegalStateException will be thrown. The default implementation of this method does nothing.
IllegalStateException - if the conflict is a deadlockabstract LockAttemptResult<K> getWaitingFor()
null if it is not waitingabstract void setWaitingFor(LockAttemptResult<K> waitingFor)
null. If waitingFor is not
null, then it should represent a conflict, and it's conflict field must not be null.
waitingFor - the lock or null
IllegalArgumentException - if waitingFor is not null and its conflict field is nullboolean checkAllowSync()
AssertionError if already synchronized on
a locker other than this one or any lock, otherwise returns true.
boolean noteSync()
AssertionError if already synchronized on any locker or lock,
otherwise returns true.
boolean noteUnsync()
AssertionError if not already synchronized on this locker,
otherwise returns true.
|
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 | |||||||||