org.apache.hadoop.hbase.zookeeper.lock
Class ZKInterProcessWriteLock
java.lang.Object
org.apache.hadoop.hbase.zookeeper.lock.ZKInterProcessLockBase
org.apache.hadoop.hbase.zookeeper.lock.ZKInterProcessWriteLock
- All Implemented Interfaces:
- InterProcessLock
@InterfaceAudience.Private
public class ZKInterProcessWriteLock
- extends ZKInterProcessLockBase
ZooKeeper based write lock:
Method Summary |
protected String |
getLockPath(String createdZNode,
List<String> children)
Determine based on a list of children under a ZNode, whether or not a
process which created a specified ZNode has obtained a lock. |
void |
reapAllLocks()
Referred in zk recipe as "Revocable Shared Locks with Freaking Laser Beams"
(http://zookeeper.apache.org/doc/trunk/recipes.html). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZKInterProcessWriteLock
public ZKInterProcessWriteLock(ZooKeeperWatcher zooKeeperWatcher,
String znode,
byte[] metadata,
InterProcessLock.MetadataHandler handler)
getLockPath
protected String getLockPath(String createdZNode,
List<String> children)
throws IOException,
InterruptedException
- Determine based on a list of children under a ZNode, whether or not a
process which created a specified ZNode has obtained a lock. If a lock is
not obtained, return the path that we should watch awaiting its deletion.
Otherwise, return null.
This method is abstract as the logic for determining whether or not a
lock is obtained depends on the type of lock being implemented.
- Specified by:
getLockPath
in class ZKInterProcessLockBase
- Parameters:
createdZNode
- The ZNode created by the process attempting to acquire
a lockchildren
- List of all child ZNodes under the lock's parent ZNode
- Returns:
- The path to watch, or null if myZNode can represent a correctly
acquired lock.
- Throws:
IOException
InterruptedException
reapAllLocks
public void reapAllLocks()
throws IOException
- Referred in zk recipe as "Revocable Shared Locks with Freaking Laser Beams"
(http://zookeeper.apache.org/doc/trunk/recipes.html).
- Throws:
IOException
- If there is an unrecoverable error reaping the locks
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.