org.javagroups.blocks
Class DistributedLock
java.lang.Object
|
+--org.javagroups.blocks.DistributedLock
- public class DistributedLock
- extends java.lang.Object
Building block implementing distributed locking: a caller needs to lock a resource on all
group members. The call either succeeds (all members have acquired a lock on the given resource),
or it fails. Locks have associated timeouts, so no lock will be held forever. The typical use case for
which this class was designed is as follows:
- Caller acquires a lock on all members. A lock (Lock) object is returned.
- If successful, caller sends a message to all members containing the lock object.
If the lock is still held, every member applies the message, otherwise an exception will
be returned to the caller.
- Caller releases the locks
- Version:
- $Revision: 1.2 $
- Author:
- Bela Ban Aug 2002
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DistributedLock
public DistributedLock(PullPushAdapter ad,
MessageListener l1,
MembershipListener l2)
DistributedLock
public DistributedLock(Channel ch,
MessageListener l1,
MembershipListener l2)
getLock
public DistributedLock.Lock getLock(java.io.Serializable resource_name,
long lease_timeout,
long max_wait_time)
throws org.javagroups.blocks.DistributedLock.LockDeniedException
apply
public void apply(Message msg,
DistributedLock.Lock l)
throws org.javagroups.blocks.DistributedLock.ResourceLockedException,
org.javagroups.blocks.DistributedLock.NoLockException
releaseLock
public void releaseLock(DistributedLock.Lock l)
Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.