org.apache.hadoop.hive.ql.lockmgr.zookeeper
Class ZooKeeperHiveLockManager

java.lang.Object
  extended by org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager
All Implemented Interfaces:
HiveLockManager

public class ZooKeeperHiveLockManager
extends Object
implements HiveLockManager


Nested Class Summary
static class ZooKeeperHiveLockManager.DummyWatcher
           
 
Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
ZooKeeperHiveLockManager()
           
 
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)
           
 List<HiveLock> lock(List<HiveLockObj> lockObjects, boolean keepAlive)
           
 void prepareRetry()
           
 void refresh()
          refresh to enable new configurations.
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

ZooKeeperHiveLockManager

public ZooKeeperHiveLockManager()
Method Detail

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

refresh

public void refresh()
Description copied from interface: HiveLockManager
refresh to enable new configurations.

Specified by:
refresh in interface HiveLockManager

lock

public List<HiveLock> lock(List<HiveLockObj> lockObjects,
                           boolean keepAlive)
                    throws LockException
Specified by:
lock in interface HiveLockManager
Parameters:
lockObjects - List of objects and the modes of the locks requested
keepAlive - Whether the lock is to be persisted after the statement 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)
                       throws LockException
Specified by:
lock in interface HiveLockManager
Parameters:
key - The object to be locked
mode - The mode of the lock
keepAlive - Whether the lock is to be persisted after the statement 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

prepareRetry

public void prepareRetry()
                  throws LockException
Specified by:
prepareRetry in interface HiveLockManager
Throws:
LockException


Copyright © 2014 The Apache Software Foundation. All rights reserved.