org.sourceforge.jemm.database.components
Class UserLockInfo
java.lang.Object
org.sourceforge.jemm.database.components.UserLockInfo
public class UserLockInfo
- extends java.lang.Object
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
UserLockInfo
public UserLockInfo(ID id)
UserLockInfo
public UserLockInfo(ID id,
ClientThreadId lockHolder,
java.util.LinkedList<ClientThreadId> lockQueue)
acquireLock
public boolean acquireLock(ClientThreadId clientThreadId)
- Attempts to acquire the lock. Returns true if the lock is acquired, otherwise
returns false and the requestor is added to the lock waiting queue.
- Parameters:
clientThreadId
- The client thread attempted to acquire the lock.
- Returns:
- True if the requesting thread acquired the lock, false if it is waiting.
- Throws:
LockInfoDeadException
- If the lock is dead and a new one should be created
releaseLock
public ClientThreadId releaseLock(ClientThreadId releasingThreadId)
- Release the lock on this object. This must be performed by the current lock holder.
If there is any waiters on the lock the first will immediately acquire the lock.
The new lock owner is returned by the method and it is the responsibility of the caller
to notify the new owner.
- Parameters:
releasingThreadId
- The current lock holder.
- Returns:
- The ClientThreadId who now holds the lock, or null if none.
releaseOrClearFromQueue
public ClientThreadId releaseOrClearFromQueue(ClientThreadId clientThreadId)
- Release the lock on this object if it is held by this thread, or removed the thread
from the waiting queue.
If the owner had changed it will be returned by this method and it is the responsibility
of the caller
to notify the new owner.
- Parameters:
clientThreadId
- The thread being cleared.
- Returns:
- The ClientThreadId of the new lock holder (if the lock holder has changed)
isUnused
public boolean isUnused()
getLockQueue
public java.util.LinkedList<ClientThreadId> getLockQueue()
getHolder
public ClientThreadId getHolder()
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
getId
public ID getId()
Copyright © 2009. All Rights Reserved.