org.jgroups.blocks
Class DistributedLockManager
java.lang.Object
org.jgroups.blocks.DistributedLockManager
- LockManager, TwoPhaseVotingListener
public class DistributedLockManager
extends java.lang.Object
Distributed lock manager is responsible for maintaining the lock information
consistent on all participating nodes.
- Roman Rokytskyy (rrokytskyy@acm.org)
void | abort(Object decree) - Abort phase for the lock acquisition or release.
|
boolean | commit(Object decree) - Commit phase for the lock acquisition or release.
|
void | lock(Object lockId, Object owner, int timeout) - Locks an object with
lockId on behalf of the specified
owner .
|
boolean | prepare(Object decree) - Prepare phase for the lock acquisition or release.
|
void | unlock(Object lockId, Object owner) - Unlocks an object with
lockId on behalf of the specified
owner .
|
DistributedLockManager
public DistributedLockManager(TwoPhaseVotingAdapter channel,
Object id)
Constructor for the DistributedLockManager_cl object.
channel
- instance of TwoPhaseVotingAdapter
that will be used for voting purposes on the lock decrees.id
- the unique identifier of this lock manager.
DistributedLockManager
public DistributedLockManager(VotingAdapter voteChannel,
Object id)
Create instance of this class.
voteChannel
- instance of VotingAdapter
that will be used
for voting purposes on the lock decrees. voteChannel() will
be wrapped by the instance of the TwoPhaseVotingAdapter
.id
- the unique identifier of this lock manager.
abort
public void abort(Object decree)
throws VoteException
Abort phase for the lock acquisition or release.
- abort in interface TwoPhaseVotingListener
decree
- should be an instance LockDecree
, if not,
we throw VoteException
to be ignored by the
VoteChannel
.
commit
public boolean commit(Object decree)
throws VoteException
Commit phase for the lock acquisition or release.
- commit in interface TwoPhaseVotingListener
decree
- should be an instance LockDecree
, if not,
we throw VoteException
to be ignored by the
VoteChannel
.
true
when commiting the lock operation succeeds.
lock
public void lock(Object lockId,
Object owner,
int timeout)
throws LockNotGrantedException,
ChannelException
Locks an object with lockId
on behalf of the specified
owner
.
- lock in interface LockManager
lockId
- Object
representing the object to be locked.owner
- object that requests the lock.timeout
- time during which group members should decide
whether to grant a lock or not.
prepare
public boolean prepare(Object decree)
throws VoteException
Prepare phase for the lock acquisition or release.
- prepare in interface TwoPhaseVotingListener
decree
- should be an instance LockDecree
, if not,
we throw VoteException
to be ignored by the
VoteChannel
.
true
when preparing the lock operation succeeds.
unlock
public void unlock(Object lockId,
Object owner)
throws LockNotReleasedException,
ChannelException
Unlocks an object with lockId
on behalf of the specified
owner
.
- unlock in interface LockManager
lockId
- long
representing the object to be unlocked.owner
- object that releases the lock.
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.