本文整理了Java中org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager.unlock()
方法的一些代码示例,展示了ZooKeeperHiveLockManager.unlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperHiveLockManager.unlock()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager
类名称:ZooKeeperHiveLockManager
方法名:unlock
暂无
代码示例来源:origin: apache/hive
/**
* @param hiveLocks
* list of hive locks to be released Release all the locks specified. If some of the
* locks have already been released, ignore them
**/
@Override
public void releaseLocks(List<HiveLock> hiveLocks) {
if (hiveLocks != null) {
int len = hiveLocks.size();
for (int pos = len-1; pos >= 0; pos--) {
HiveLock hiveLock = hiveLocks.get(pos);
try {
LOG.debug("About to release lock for {}",
hiveLock.getHiveLockObject().getName());
unlock(hiveLock);
} catch (LockException e) {
// The lock may have been released. Ignore and continue
LOG.warn("Error when releasing lock", e);
}
}
}
}
代码示例来源:origin: apache/drill
/**
* @param hiveLocks
* list of hive locks to be released Release all the locks specified. If some of the
* locks have already been released, ignore them
**/
@Override
public void releaseLocks(List<HiveLock> hiveLocks) {
if (hiveLocks != null) {
int len = hiveLocks.size();
for (int pos = len-1; pos >= 0; pos--) {
HiveLock hiveLock = hiveLocks.get(pos);
try {
LOG.debug("About to release lock for {}",
hiveLock.getHiveLockObject().getName());
unlock(hiveLock);
} catch (LockException e) {
// The lock may have been released. Ignore and continue
LOG.warn("Error when releasing lock", e);
}
}
}
}
代码示例来源:origin: apache/hive
@Test
public void testMetrics() throws Exception{
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM, "localhost");
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CLIENT_PORT, String.valueOf(server.getPort()));
conf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_METRICS_ENABLED, true);
conf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
conf.setVar(HiveConf.ConfVars.HIVE_METRICS_REPORTER, MetricsReporting.JSON_FILE.name() + "," + MetricsReporting.JMX.name());
MetricsFactory.init(conf);
CodahaleMetrics metrics = (CodahaleMetrics) MetricsFactory.getInstance();
HiveLockManagerCtx ctx = new HiveLockManagerCtx(conf);
ZooKeeperHiveLockManager zMgr= new ZooKeeperHiveLockManager();
zMgr.setContext(ctx);
ZooKeeperHiveLock curLock = zMgr.lock(hiveLock, HiveLockMode.SHARED, false);
String json = metrics.dumpJson();
MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.COUNTER, MetricsConstant.ZOOKEEPER_HIVE_SHAREDLOCKS, 1);
zMgr.unlock(curLock);
json = metrics.dumpJson();
MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.COUNTER, MetricsConstant.ZOOKEEPER_HIVE_SHAREDLOCKS, 0);
zMgr.close();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* @param hiveLocks
* list of hive locks to be released Release all the locks specified. If some of the
* locks have already been released, ignore them
**/
public void releaseLocks(List<HiveLock> hiveLocks) {
if (hiveLocks != null) {
int len = hiveLocks.size();
for (int pos = len-1; pos >= 0; pos--) {
HiveLock hiveLock = hiveLocks.get(pos);
try {
unlock(hiveLock);
} catch (LockException e) {
// The lock may have been released. Ignore and continue
}
}
}
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
public void unlock(HiveLock hiveLock) throws LockException {
unlock(ctx.getConf(), zooKeeper, hiveLock, parent);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
/**
* @param hiveLocks
* list of hive locks to be released Release all the locks specified. If some of the
* locks have already been released, ignore them
**/
public void releaseLocks(List<HiveLock> hiveLocks) {
if (hiveLocks != null) {
int len = hiveLocks.size();
for (int pos = len-1; pos >= 0; pos--) {
HiveLock hiveLock = hiveLocks.get(pos);
try {
LOG.info(" about to release lock for " + hiveLock.getHiveLockObject().getName());
unlock(hiveLock);
} catch (LockException e) {
// The lock may have been released. Ignore and continue
LOG.warn("Error when releasing lock", e);
}
}
}
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
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());
}
}
内容来源于网络,如有侵权,请联系作者删除!