| org.jgroups.blocks.LockManager
All known Subclasses: org.jgroups.blocks.DistributedLockManager,
LockManager | public interface LockManager (Code) | | LockManager represents generic lock manager that allows
obtaining and releasing locks on objects.
author: Roman Rokytskyy (rrokytskyy@acm.org) author: Robert Schaffar-Taurok (robert@fusion.at) version: $Id: LockManager.java,v 1.2 2005/06/08 15:56:54 publicnmi Exp $ |
Method Summary | |
void | lock(Object obj, Object owner, int timeout) Obtain lock on obj for specified owner . | void | unlock(Object obj, Object owner) Release lock on obj owned by specified owner . | void | unlock(Object obj, Object owner, boolean releaseMultiLocked) Release lock on obj owned by specified owner . |
lock | void lock(Object obj, Object owner, int timeout) throws LockNotGrantedException, ClassCastException, ChannelException(Code) | | Obtain lock on obj for specified owner .
Implementation should try to obtain lock few times within the
specified timeout.
Parameters: obj - obj to lock, usually not full object but object's ID. Parameters: owner - object identifying entity that will own the lock. Parameters: timeout - maximum time that we grant to obtain a lock. throws: LockNotGrantedException - if lock is not granted withinspecified period. throws: ClassCastException - if obj and/orowner is not of type that implementation expects to get(for example, when distributed lock manager obtains non-serializableobj or owner ). throws: ChannelException - if something bad happened to communicationchannel. |
unlock | void unlock(Object obj, Object owner) throws LockNotReleasedException, ClassCastException, ChannelException(Code) | | Release lock on obj owned by specified owner .
since 2.2.9 this method is only a wrapper for
unlock(Object lockId, Object owner, boolean releaseMultiLocked).
Use that with releaseMultiLocked set to true if you want to be able to
release multiple locked locks (for example after a merge)
Parameters: obj - obj to lock, usually not full object but object's ID. Parameters: owner - object identifying entity that will own the lock. throws: LockOwnerMismatchException - if lock is owned by another object. throws: ClassCastException - if obj and/orowner is not of type that implementation expects to get(for example, when distributed lock manager obtains non-serializableobj or owner ). throws: ChannelException - if something bad happened to communicationchannel. |
unlock | void unlock(Object obj, Object owner, boolean releaseMultiLocked) throws LockNotReleasedException, ClassCastException, ChannelException, LockMultiLockedException(Code) | | Release lock on obj owned by specified owner .
Parameters: obj - obj to lock, usually not full object but object's ID. Parameters: owner - object identifying entity that will own the lock. Parameters: releaseMultiLocked - force unlocking of the lock if the locallockManager owns the lock even if another lockManager owns the same lock throws: LockOwnerMismatchException - if lock is owned by another object. throws: ClassCastException - if obj and/orowner is not of type that implementation expects to get(for example, when distributed lock manager obtains non-serializableobj or owner ). throws: ChannelException - if something bad happened to communicationchannel. throws: LockMultiLockedException - if the lock was unlocked, but anothernode already held the lock |
|
|