org.apache.hadoop.hive.ql.lockmgr.zookeeper
Class ZooKeeperHiveLockManager
java.lang.Object
org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager
- All Implemented Interfaces:
- HiveLockManager
public class ZooKeeperHiveLockManager
- extends Object
- implements HiveLockManager
Field Summary |
static org.apache.commons.logging.Log |
LOG
|
Method Summary |
void |
close()
|
List<HiveLock> |
getLocks(boolean verifyTablePartition,
boolean fetchData)
|
List<HiveLock> |
getLocks(HiveLockObject key,
boolean verifyTablePartitions,
boolean fetchData)
|
ZooKeeperHiveLock |
lock(HiveLockObject key,
HiveLockMode mode,
boolean keepAlive,
int numRetries,
int sleepTime)
|
List<HiveLock> |
lock(List<HiveLockObj> lockObjects,
boolean keepAlive,
int numRetries,
int sleepTime)
|
static void |
releaseAllLocks(HiveConf conf)
|
void |
releaseLocks(List<HiveLock> hiveLocks)
|
void |
setContext(HiveLockManagerCtx ctx)
|
void |
unlock(HiveLock hiveLock)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
public static final org.apache.commons.logging.Log LOG
ZooKeeperHiveLockManager
public ZooKeeperHiveLockManager()
setContext
public void setContext(HiveLockManagerCtx ctx)
throws LockException
- Specified by:
setContext
in interface HiveLockManager
- Parameters:
ctx
- The lock manager context (containing the Hive configuration file)
Start the ZooKeeper client based on the zookeeper cluster specified in the conf.
- Throws:
LockException
lock
public List<HiveLock> lock(List<HiveLockObj> lockObjects,
boolean keepAlive,
int numRetries,
int sleepTime)
throws LockException
- Specified by:
lock
in interface HiveLockManager
- Parameters:
lockObjects
- List of objects and the modes of the locks requestedkeepAlive
- Whether the lock is to be persisted after the statementnumRetries
- number of retries when the lock can not be acquiredsleepTime
- sleep time between retries
Acuire all the locks. Release all the locks and return null if any lock
could not be acquired.
- Throws:
LockException
releaseLocks
public void releaseLocks(List<HiveLock> hiveLocks)
- Specified by:
releaseLocks
in interface HiveLockManager
- Parameters:
hiveLocks
- list of hive locks to be released Release all the locks specified. If some of the
locks have already been released, ignore them
lock
public ZooKeeperHiveLock lock(HiveLockObject key,
HiveLockMode mode,
boolean keepAlive,
int numRetries,
int sleepTime)
throws LockException
- Specified by:
lock
in interface HiveLockManager
- Parameters:
key
- The object to be lockedmode
- The mode of the lockkeepAlive
- Whether the lock is to be persisted after the statementnumRetries
- number of retries when the lock can not be acquiredsleepTime
- sleep time between retries
Acuire the lock. Return null if a conflicting lock is present.
- Throws:
LockException
unlock
public void unlock(HiveLock hiveLock)
throws LockException
- Specified by:
unlock
in interface HiveLockManager
- Throws:
LockException
releaseAllLocks
public static void releaseAllLocks(HiveConf conf)
throws Exception
- Throws:
Exception
getLocks
public List<HiveLock> getLocks(boolean verifyTablePartition,
boolean fetchData)
throws LockException
- Specified by:
getLocks
in interface HiveLockManager
- Throws:
LockException
getLocks
public List<HiveLock> getLocks(HiveLockObject key,
boolean verifyTablePartitions,
boolean fetchData)
throws LockException
- Specified by:
getLocks
in interface HiveLockManager
- Throws:
LockException
close
public void close()
throws LockException
- Specified by:
close
in interface HiveLockManager
- Throws:
LockException
Copyright © 2011 The Apache Software Foundation