gpt4 book ai didi

org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLock类的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 00:37:31 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLock类的一些代码示例,展示了ZooKeeperHiveLock类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperHiveLock类的具体详情如下:
包路径:org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLock
类名称:ZooKeeperHiveLock

ZooKeeperHiveLock介绍

暂无

代码示例

代码示例来源:origin: apache/hive

HiveLock lck = (new ZooKeeperHiveLock(curChild, obj, mode));
locks.add(lck);

代码示例来源:origin: apache/hive

@Override
public boolean equals(Object o) {
 if (!(o instanceof ZooKeeperHiveLock)) {
  return false;
 }
 ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)o;
 return path.equals(zLock.getPath()) &&
  obj.equals(zLock.getHiveLockObject()) &&
  mode == zLock.getHiveLockMode();
}

代码示例来源:origin: apache/hive

ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)hiveLock;
HiveLockMode lMode = hiveLock.getHiveLockMode();
HiveLockObject obj = zLock.getHiveLockObject();
String name  = getLastObjectName(parent, obj);
try {
  curatorFramework.delete().forPath(zLock.getPath());
 } catch (InterruptedException ie) {
  curatorFramework.delete().forPath(zLock.getPath());
 LOG.debug("Node " + zLock.getPath() + " or its parent has already been deleted.");
} catch (KeeperException.NotEmptyException nee) {

代码示例来源: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

ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)hiveLock;
HiveLockMode lMode = hiveLock.getHiveLockMode();
HiveLockObject obj = zLock.getHiveLockObject();
String name  = getLastObjectName(parent, obj);
try {
  curatorFramework.delete().forPath(zLock.getPath());
 } catch (InterruptedException ie) {
  curatorFramework.delete().forPath(zLock.getPath());
 LOG.debug("Node " + zLock.getPath() + " or its parent has already been deleted.");
} catch (KeeperException.NotEmptyException nee) {

代码示例来源: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/drill

@Override
public boolean equals(Object o) {
 if (!(o instanceof ZooKeeperHiveLock)) {
  return false;
 }
 ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)o;
 return path.equals(zLock.getPath()) &&
  obj.equals(zLock.getHiveLockObject()) &&
  mode == zLock.getHiveLockMode();
}

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

private static void unlock(HiveConf conf, ZooKeeper zkpClient,
              HiveLock hiveLock, String parent) throws LockException {
 ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)hiveLock;
 try {
  zkpClient.delete(zLock.getPath(), -1);
  // Delete the parent node if all the children have been deleted
  HiveLockObject obj = zLock.getHiveLockObject();
  String name  = getLastObjectName(parent, obj);
  List<String> children = zkpClient.getChildren(name, false);
  if ((children == null) || (children.isEmpty()))
  {
   zkpClient.delete(name, -1);
  }
 } catch (Exception e) {
  LOG.error("Failed to release ZooKeeper lock: " + e);
  throw new LockException(e);
 }
}

代码示例来源:origin: apache/drill

HiveLock lck = (new ZooKeeperHiveLock(curChild, obj, mode));
locks.add(lck);

代码示例来源: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

@Override
 public boolean equals(Object o) {
  if (!(o instanceof ZooKeeperHiveLock)) {
   return false;
  }

  ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)o;

  return path.equals(zLock.getPath()) &&
   obj.equals(zLock.getHiveLockObject()) &&
   mode == zLock.getHiveLockMode();
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@VisibleForTesting
static void unlockPrimitive(HiveLock hiveLock, String parent, CuratorFramework curatorFramework) throws LockException {
 ZooKeeperHiveLock zLock = (ZooKeeperHiveLock)hiveLock;
 HiveLockObject obj = zLock.getHiveLockObject();
 String name  = getLastObjectName(parent, obj);
 try {
  curatorFramework.delete().forPath(zLock.getPath());
  // Delete the parent node if all the children have been deleted
  List<String> children = curatorFramework.getChildren().forPath(name);
  if (children == null || children.isEmpty()) {
   curatorFramework.delete().forPath(name);
  }
 } catch (KeeperException.NoNodeException nne) {
  //can happen in retrying deleting the zLock after exceptions like InterruptedException
  //or in a race condition where parent has already been deleted by other process when it
  //is to be deleted. Both cases should not raise error
  LOG.debug("Node " + zLock.getPath() + " or its parent has already been deleted.");
 } catch (KeeperException.NotEmptyException nee) {
  //can happen in a race condition where another process adds a zLock under this parent
  //just before it is about to be deleted. It should not be a problem since this parent
  //can eventually be deleted by the process which hold its last child zLock
  LOG.debug("Node " + name + " to be deleted is not empty.");
 } catch (Exception e) {
  //exceptions including InterruptException and other KeeperException
  LOG.error("Failed to release ZooKeeper lock: ", e);
  throw new LockException(e);
 }
}

代码示例来源:origin: apache/hive

@Before
public void setup() {
 conf = new HiveConf();
 lockObjData = new HiveLockObjectData("1", "10", "SHARED", "show tables", conf);
 hiveLock = new HiveLockObject(TABLE, lockObjData);
 zLock = new ZooKeeperHiveLock(TABLE_LOCK_PATH, hiveLock, HiveLockMode.SHARED);
 while (server == null)
 {
  try {
   server = new TestingServer();
   CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
   client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).build();
   client.start();
  } catch (Exception e) {
   System.err.println("Getting bind exception - retrying to allocate server");
   server = null;
  }
 }
}

代码示例来源:origin: apache/hive

return new ZooKeeperHiveLock(res, key, mode);

代码示例来源:origin: apache/drill

return new ZooKeeperHiveLock(res, key, mode);

代码示例来源:origin: apache/hive

expectedLocks.add(new ZooKeeperHiveLock("default", new HiveLockObject(), HiveLockMode.SHARED));
expectedLocks.add(new ZooKeeperHiveLock("default.table1", new HiveLockObject(), HiveLockMode.SHARED));
LockedDriverState lDrvState = new LockedDriverState();
LockedDriverState lDrvInp = new LockedDriverState();

代码示例来源:origin: com.facebook.presto.hive/hive-apache

HiveLock lck = (HiveLock)(new ZooKeeperHiveLock(curChild, obj, mode));
locks.add(lck);

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

HiveLock lck = (HiveLock)(new ZooKeeperHiveLock(curChild, obj, mode));
locks.add(lck);

代码示例来源:origin: com.facebook.presto.hive/hive-apache

return new ZooKeeperHiveLock(res, key, mode);

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

return new ZooKeeperHiveLock(res, key, mode);

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