public static void releaseAllLocks(HiveConf conf) throws Exception {
try {
int sessionTimeout = conf.getIntVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_SESSION_TIMEOUT);
String quorumServers = getQuorumServers(conf);
ZooKeeper zkpClient = new ZooKeeper(quorumServers, sessionTimeout, new DummyWatcher());
String parent = conf.getVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_NAMESPACE);
List<HiveLock> locks = getLocks(conf, zkpClient, null, parent, false, false);
if (locks != null) {
for (HiveLock lock : locks) {
unlock(conf, zkpClient, lock, parent);
}
}
zkpClient.close();
zkpClient = null;
} catch (Exception e) {
LOG.error("Failed to release all locks: " + e.getMessage());
throw new Exception(ErrorMsg.ZOOKEEPER_CLIENT_COULD_NOT_BE_INITIALIZED.getMsg());
}
}