com.sun.sgs.impl.util.lock
Class BasicLocker<K>

java.lang.Object
  extended by com.sun.sgs.impl.util.lock.Locker<K>
      extended by com.sun.sgs.impl.util.lock.BasicLocker<K>
Type Parameters:
K - the type of key
Direct Known Subclasses:
TxnLocker

public class BasicLocker<K>
extends Locker<K>

Records information about an entity that requests locks from a LockManager and that permits only a single active lock request.


Field Summary
 
Fields inherited from class com.sun.sgs.impl.util.lock.Locker
lockManager
 
Constructor Summary
BasicLocker(LockManager<K> lockManager)
          Creates an instance of this class.
 
Method Summary
(package private)  LockAttemptResult<K> getWaitingFor()
          Checks if this locker is waiting for a lock.
(package private)  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 com.sun.sgs.impl.util.lock.Locker
checkAllowSync, clearConflict, getConflict, getLockManager, getLockTimeoutTime, newLockRequest, noteSync, noteUnsync
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicLocker

public BasicLocker(LockManager<K> lockManager)
Creates an instance of this class.

Parameters:
lockManager - the lock manager for this locker
Method Detail

getWaitingFor

LockAttemptResult<K> getWaitingFor()
Checks if this locker is waiting for a lock.

This implementation returns the lock attempt request associated with this locker, if any.

Specified by:
getWaitingFor in class Locker<K>
Returns:
the result of the attempt to request a lock that this locker is waiting for, or null if it is not waiting

setWaitingFor

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. If waitingFor is not null, then it should represent a conflict, and it's conflict field must not be null.

This implementation sets the lock attempt request associated with this locker.

Specified by:
setWaitingFor in class Locker<K>
Parameters:
waitingFor - the lock or null
Throws:
IllegalArgumentException - if waitingFor is not null and its conflict field is null

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved