|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.javagroups.blocks.DistributedLockManager
Distributed lock manager is responsible for maintaining the lock information consistent on all participating nodes.
Inner Class Summary | |
static class |
DistributedLockManager.AcquireLockDecree
This class represents the lock to be released. |
static class |
DistributedLockManager.LockDecree
This class represents the lock |
static class |
DistributedLockManager.ReleaseLockDecree
This class represents the lock to be released. |
Constructor Summary | |
DistributedLockManager(TwoPhaseVotingAdapter channel,
java.lang.Object id)
Constructor for the DistributedLockManager_cl object. |
|
DistributedLockManager(VotingAdapter voteChannel,
java.lang.Object id)
Create instance of this class. |
Method Summary | |
void |
abort(java.lang.Object decree)
Abort phase for the lock acquisition or release. |
boolean |
commit(java.lang.Object decree)
Commit phase for the lock acquisition or release. |
void |
lock(java.lang.Object lockId,
java.lang.Object owner,
int timeout)
Locks an object with lockId on behalf of the specified
owner . |
boolean |
prepare(java.lang.Object decree)
Prepare phase for the lock acquisition or release. |
void |
unlock(java.lang.Object lockId,
java.lang.Object owner)
Unlocks an object with lockId on behalf of the specified
owner . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DistributedLockManager(VotingAdapter voteChannel, java.lang.Object id)
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.public DistributedLockManager(TwoPhaseVotingAdapter channel, java.lang.Object id)
channel
- instance of TwoPhaseVotingAdapter
that will be used for voting purposes on the lock decrees.id
- the unique identifier of this lock manager.Method Detail |
public void lock(java.lang.Object lockId, java.lang.Object owner, int timeout) throws LockNotGrantedException, ChannelException
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.LockNotGrantedException
- when the lock cannot be granted.java.lang.ClassCastException
- if lockId or owner are not serializable.ChannelException
- if something bad happened to underlying channel.public void unlock(java.lang.Object lockId, java.lang.Object owner) throws LockNotReleasedException, ChannelException
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.LockOwnerMismatchException
- when the lock cannot be released.java.lang.ClassCastException
- if lockId or owner are not serializable.public boolean prepare(java.lang.Object decree) throws VoteException
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.VoteException
- if we should be ignored during voting.public boolean commit(java.lang.Object decree) throws VoteException
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.VoteException
- if we should be ignored during voting.public void abort(java.lang.Object decree) throws VoteException
abort
in interface TwoPhaseVotingListener
decree
- should be an instance LockDecree
, if not,
we throw VoteException
to be ignored by the
VoteChannel
.VoteException
- if we should be ignored during voting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |