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

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

public class MultiLocker<K>
extends Locker<K>

Records information about an entity that requests locks from a MultiLockManager.


Field Summary
 
Fields inherited from class com.sun.sgs.impl.util.lock.Locker
lockManager
 
Constructor Summary
MultiLocker(MultiLockManager<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

MultiLocker

public MultiLocker(MultiLockManager<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 value for the current thread obtained from the MultiLockManager.

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 value for the current thread in the MultiLockManager.

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