gpt4 book ai didi

org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager.unlockPrimitive()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 18:23:31 25 4
gpt4 key购买 nike

本文整理了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

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());
 }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com