本文整理了Java中org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager.unlockPrimitive()
方法的一些代码示例,展示了ZooKeeperHiveLockManager.unlockPrimitive()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperHiveLockManager.unlockPrimitive()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager
类名称:ZooKeeperHiveLockManager
方法名:unlockPrimitive
暂无
代码示例来源:origin: apache/hive
private void unlockWithRetry(HiveLock hiveLock, String parent) throws LockException {
int tryNum = 0;
do {
try {
tryNum++;
if (tryNum > 1) {
Thread.sleep(sleepTime);
}
unlockPrimitive(hiveLock, parent, curatorFramework);
break;
} catch (Exception e) {
if (tryNum >= numRetriesForUnLock) {
String name = ((ZooKeeperHiveLock)hiveLock).getPath();
throw new LockException("Node " + name + " can not be deleted after " + numRetriesForUnLock + " attempts.",
e);
}
}
} while (tryNum < numRetriesForUnLock);
return;
}
代码示例来源:origin: apache/drill
private void unlockWithRetry(HiveLock hiveLock, String parent) throws LockException {
int tryNum = 0;
do {
try {
tryNum++;
if (tryNum > 1) {
Thread.sleep(sleepTime);
}
unlockPrimitive(hiveLock, parent, curatorFramework);
break;
} catch (Exception e) {
if (tryNum >= numRetriesForUnLock) {
String name = ((ZooKeeperHiveLock)hiveLock).getPath();
LOG.error("Node " + name + " can not be deleted after " + numRetriesForUnLock + " attempts.");
throw new LockException(e);
}
}
} while (tryNum < numRetriesForUnLock);
return;
}
代码示例来源:origin: apache/hive
public static void releaseAllLocks(HiveConf conf) throws Exception {
try {
String parent = conf.getVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_NAMESPACE);
List<HiveLock> locks = getLocks(conf, null, parent, false, false);
Exception lastExceptionGot = null;
if (locks != null) {
for (HiveLock lock : locks) {
try {
unlockPrimitive(lock, parent, curatorFramework);
} catch (Exception e) {
lastExceptionGot = e;
}
}
}
// if we got exception during doing the unlock, rethrow it here
if(lastExceptionGot != null) {
throw lastExceptionGot;
}
} catch (Exception e) {
LOG.error("Failed to release all locks: ", e);
throw new Exception(ErrorMsg.ZOOKEEPER_CLIENT_COULD_NOT_BE_INITIALIZED.getMsg());
}
}
代码示例来源:origin: apache/drill
public static void releaseAllLocks(HiveConf conf) throws Exception {
try {
String parent = conf.getVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_NAMESPACE);
List<HiveLock> locks = getLocks(conf, null, parent, false, false);
Exception lastExceptionGot = null;
if (locks != null) {
for (HiveLock lock : locks) {
try {
unlockPrimitive(lock, parent, curatorFramework);
} catch (Exception e) {
lastExceptionGot = e;
}
}
}
// if we got exception during doing the unlock, rethrow it here
if(lastExceptionGot != null) {
throw lastExceptionGot;
}
} catch (Exception e) {
LOG.error("Failed to release all locks: ", e);
throw new Exception(ErrorMsg.ZOOKEEPER_CLIENT_COULD_NOT_BE_INITIALIZED.getMsg());
}
}
代码示例来源:origin: apache/hive
@Test
public void testDeleteNoChildren() throws Exception
{
client.create().creatingParentsIfNeeded().forPath(TABLE_LOCK_PATH, lockObjData.toString().getBytes());
byte[] data = client.getData().forPath(TABLE_LOCK_PATH);
Assert.assertArrayEquals(lockObjData.toString().getBytes(), data);
ZooKeeperHiveLockManager.unlockPrimitive(zLock, PARENT, client);
try {
data = client.getData().forPath(TABLE_LOCK_PATH);
Assert.fail();
} catch (Exception e) {
Assert.assertEquals( e instanceof KeeperException.NoNodeException, true);
}
try {
data = client.getData().forPath(PARENT_LOCK_PATH);
Assert.fail();
} catch (Exception e) {
Assert.assertEquals( e instanceof KeeperException.NoNodeException, true);
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private void unlockWithRetry(HiveLock hiveLock, String parent) throws LockException {
int tryNum = 0;
do {
try {
tryNum++;
if (tryNum > 1) {
Thread.sleep(sleepTime);
}
unlockPrimitive(hiveLock, parent, curatorFramework);
break;
} catch (Exception e) {
if (tryNum >= numRetriesForUnLock) {
String name = ((ZooKeeperHiveLock)hiveLock).getPath();
LOG.error("Node " + name + " can not be deleted after " + numRetriesForUnLock + " attempts.");
throw new LockException(e);
}
}
} while (tryNum < numRetriesForUnLock);
return;
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public static void releaseAllLocks(HiveConf conf) throws Exception {
try {
String parent = conf.getVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_NAMESPACE);
List<HiveLock> locks = getLocks(conf, null, parent, false, false);
Exception lastExceptionGot = null;
if (locks != null) {
for (HiveLock lock : locks) {
try {
unlockPrimitive(lock, parent, curatorFramework);
} catch (Exception e) {
lastExceptionGot = e;
}
}
}
// if we got exception during doing the unlock, rethrow it here
if(lastExceptionGot != null) {
throw lastExceptionGot;
}
} catch (Exception e) {
LOG.error("Failed to release all locks: ", e);
throw new Exception(ErrorMsg.ZOOKEEPER_CLIENT_COULD_NOT_BE_INITIALIZED.getMsg());
}
}
内容来源于网络,如有侵权,请联系作者删除!