Package org.jgroups.blocks.locking
Class LockService
java.lang.Object
org.jgroups.blocks.locking.LockService
Deprecated.
See http://belaban.blogspot.com/2020/11/i-hate-distributed-locks.html.
LockService is the main class for to use for distributed locking functionality. LockService needs access to a
JChannel and interacts with a locking protocol (e.g. CENTRAL_LOCK) via events.When no locking protocol is seen on the channel's stack, LockService will throw an exception at startup. An example of using LockService is:
JChannel ch=new JChannel("/home/bela/locking.xml); // locking.xml needs to have a locking protocol towards the top
LockService lock_service=new LockService(ch);
ch.connect("lock-cluster");
Lock lock=lock_service.getLock("mylock");
lock.lock();
try {
// do something with the lock acquired
}
finally {
lock.unlock();
}
The exact semantics of this lock implemantation are defined in LockService.LockImpl.
Note that, contrary to the semantics of Lock, unlock() can be called multiple
times; after a lock has been released, future calls to unlock() have no effect.
- Since:
- 2.12
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classDeprecated.protected classDeprecated.Implementation ofLock. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLockListener(LockNotification listener) Deprecated.Deprecated.Deprecated.voidremoveLockListener(LockNotification listener) Deprecated.voidsetChannel(JChannel ch) Deprecated.voidDeprecated.voidunlockForce(String lock_name) Deprecated.
-
Field Details
-
ch
Deprecated. -
lock_prot
Deprecated.
-
-
Constructor Details
-
LockService
public LockService()Deprecated. -
LockService
Deprecated.
-
-
Method Details
-
setChannel
Deprecated. -
getLock
Deprecated. -
unlockAll
public void unlockAll()Deprecated. -
unlockForce
Deprecated. -
addLockListener
Deprecated. -
removeLockListener
Deprecated. -
printLocks
Deprecated.
-