| java.lang.Object org.jgroups.blocks.DistributedLockManager
DistributedLockManager | public class DistributedLockManager implements TwoPhaseVotingListener,LockManager,VoteResponseProcessor,MembershipListener(Code) | | Distributed lock manager is responsible for maintaining the lock information
consistent on all participating nodes.
author: Roman Rokytskyy (rrokytskyy@acm.org) author: Robert Schaffar-Taurok (robert@fusion.at) version: $Id: DistributedLockManager.java,v 1.8 2006/08/15 09:18:53 belaban Exp $ |
Inner Class :public static class LockDecree implements Serializable | |
Inner Class :public static class AcquireLockDecree extends LockDecree | |
Inner Class :public static class ReleaseLockDecree extends LockDecree | |
Inner Class :public static class MultiLockDecree extends LockDecree | |
Method Summary | |
public synchronized void | abort(Object decree) Abort phase for the lock acquisition or release. | public void | block() | public synchronized boolean | commit(Object decree) Commit phase for the lock acquisition or release.
Parameters: decree - should be an instance LockDecree , if not,we throw VoteException to be ignored by theVoteChannel . | public void | lock(Object lockId, Object owner, int timeout) Locks an object with lockId on behalf of the specified
owner .
Parameters: lockId - Object representing the object to be locked. Parameters: owner - object that requests the lock. | public synchronized boolean | prepare(Object decree) Prepare phase for the lock acquisition or release.
Parameters: decree - should be an instance LockDecree , if not,we throw VoteException to be ignored by theVoteChannel . | public boolean | processResponses(RspList responses, int consensusType, Object decree) Processes the response list and votes like the default processResponses method with the consensusType VOTE_ALL
If the result of the voting is false, but this DistributedLockManager owns the lock, the result is changed to
true and the lock is released, but marked as multiple locked. | public void | suspect(Address suspected_mbr) | public void | unlock(Object lockId, Object owner) Unlocks an object with lockId on behalf of the specified
owner . | public void | unlock(Object lockId, Object owner, long timeout) | public void | unlock(Object lockId, Object owner, boolean releaseMultiLocked) Unlocks an object with lockId on behalf of the specified
owner .
Parameters: lockId - long representing the object to be unlocked. Parameters: owner - object that releases the lock. Parameters: releaseMultiLocked - releases also multiple locked locks. | public void | unlock(Object lockId, Object owner, boolean releaseMultiLocked, long timeout) | public void | viewAccepted(View new_view) |
log | final protected Log log(Code) | | |
DistributedLockManager | public DistributedLockManager(VotingAdapter voteChannel, Object id)(Code) | | Create instance of this class.
Parameters: voteChannel - instance of VotingAdapter that will be used for voting purposes on the lock decrees. voteChannel() willbe wrapped by the instance of the TwoPhaseVotingAdapter. Parameters: id - the unique identifier of this lock manager.todo check if the node with the same id is already in the group. |
DistributedLockManager | public DistributedLockManager(TwoPhaseVotingAdapter channel, Object id)(Code) | | Constructor for the DistributedLockManager_cl object.
Parameters: channel - instance of TwoPhaseVotingAdapterthat will be used for voting purposes on the lock decrees. Parameters: id - the unique identifier of this lock manager. |
abort | public synchronized void abort(Object decree) throws VoteException(Code) | | Abort phase for the lock acquisition or release.
Parameters: decree - should be an instance LockDecree , if not,we throw VoteException to be ignored by theVoteChannel . throws: VoteException - if we should be ignored during voting. |
block | public void block()(Code) | | |
commit | public synchronized boolean commit(Object decree) throws VoteException(Code) | | Commit phase for the lock acquisition or release.
Parameters: decree - should be an instance LockDecree , if not,we throw VoteException to be ignored by theVoteChannel . true when commiting the lock operation succeeds. throws: VoteException - if we should be ignored during voting. |
lock | public void lock(Object lockId, Object owner, int timeout) throws LockNotGrantedException, ChannelException(Code) | | Locks an object with lockId on behalf of the specified
owner .
Parameters: lockId - Object representing the object to be locked. Parameters: owner - object that requests the lock. This should be the Address of a JGroups member, otherwise we cannotrelease the locks for a crashed member ! Parameters: timeout - time during which group members should decidewhether to grant a lock or not. throws: LockNotGrantedException - when the lock cannot be granted. throws: ClassCastException - if lockId or owner are not serializable. throws: ChannelException - if something bad happened to underlying channel. |
prepare | public synchronized boolean prepare(Object decree) throws VoteException(Code) | | Prepare phase for the lock acquisition or release.
Parameters: decree - should be an instance LockDecree , if not,we throw VoteException to be ignored by theVoteChannel . true when preparing the lock operation succeeds. throws: VoteException - if we should be ignored during voting. |
processResponses | public boolean processResponses(RspList responses, int consensusType, Object decree) throws ChannelException(Code) | | Processes the response list and votes like the default processResponses method with the consensusType VOTE_ALL
If the result of the voting is false, but this DistributedLockManager owns the lock, the result is changed to
true and the lock is released, but marked as multiple locked. (only in the prepare state to reduce traffic)
Note: we do not support voting in case of Byzantine failures, i.e.
when the node responds with the fault message.
|
unlock | public void unlock(Object lockId, Object owner) throws LockNotReleasedException, ChannelException(Code) | | Unlocks an object with lockId on behalf of the 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: lockId - long representing the object to be unlocked. Parameters: owner - object that releases the lock. throws: LockNotReleasedException - when the lock cannot be released. throws: ClassCastException - if lockId or owner are not serializable. |
viewAccepted | public void viewAccepted(View new_view)(Code) | | Remove all locks held by members who left the previous view
|
|
|