本文整理了Java中org.apache.hadoop.hbase.ZooKeeperConnectionException
类的一些代码示例,展示了ZooKeeperConnectionException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperConnectionException
类的具体详情如下:
包路径:org.apache.hadoop.hbase.ZooKeeperConnectionException
类名称:ZooKeeperConnectionException
[英]Thrown if the client can't connect to zookeeper
[中]如果客户端无法连接到zookeeper,则引发
代码示例来源:origin: apache/hbase
private void createBaseZNodes() throws ZooKeeperConnectionException {
try {
// Create all the necessary "directories" of znodes
ZKUtil.createWithParents(this, znodePaths.baseZNode);
ZKUtil.createAndFailSilent(this, znodePaths.rsZNode);
ZKUtil.createAndFailSilent(this, znodePaths.drainingZNode);
ZKUtil.createAndFailSilent(this, znodePaths.tableZNode);
ZKUtil.createAndFailSilent(this, znodePaths.splitLogZNode);
ZKUtil.createAndFailSilent(this, znodePaths.backupMasterAddressesZNode);
ZKUtil.createAndFailSilent(this, znodePaths.tableLockZNode);
ZKUtil.createAndFailSilent(this, znodePaths.masterMaintZNode);
} catch (KeeperException e) {
throw new ZooKeeperConnectionException(
prefix("Unexpected KeeperException creating base node"), e);
}
}
代码示例来源:origin: Impetus/Kundera
message = zkce.getMessage();
logger.error("Unable to connect to zookeeper, Caused by:", zkce);
代码示例来源:origin: JFanZhao/spider
/**
* 构造函数 加载配置
*/
public HBaseUtils() {
// TODO Auto-generated constructor stub
conf = new Configuration();
conf.set("hbase.zookeeper.quorum", "192.168.57.133:2181");
conf.set("hbase.rootdir", "hdfs://192.168.57.133:9000/hbase");
try {
admin = new HBaseAdmin(conf);
} catch (MasterNotRunningException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ZooKeeperConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
代码示例来源:origin: apache/hbase
/**
* Ensure passed zookeeper is connected.
* @param timeout Time to wait on established Connection
*/
public static ZooKeeper ensureConnectedZooKeeper(ZooKeeper zookeeper, int timeout)
throws ZooKeeperConnectionException {
if (zookeeper.getState().isConnected()) {
return zookeeper;
}
Stopwatch stopWatch = Stopwatch.createStarted();
// Make sure we are connected before we hand it back.
while(!zookeeper.getState().isConnected()) {
Threads.sleep(1);
if (stopWatch.elapsed(TimeUnit.MILLISECONDS) > timeout) {
throw new ZooKeeperConnectionException("Failed connect after waiting " +
stopWatch.elapsed(TimeUnit.MILLISECONDS) + "ms (zk session timeout); " +
zookeeper);
}
}
return zookeeper;
}
}
代码示例来源:origin: Impetus/Kundera
message = zkce.getMessage();
logger.error("Unable to connect to zookeeper, Caused by:", zkce);
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Ensure passed zookeeper is connected.
* @param timeout Time to wait on established Connection
*/
public static ZooKeeper ensureConnectedZooKeeper(ZooKeeper zookeeper, int timeout)
throws ZooKeeperConnectionException {
if (zookeeper.getState().isConnected()) {
return zookeeper;
}
Stopwatch stopWatch = Stopwatch.createStarted();
// Make sure we are connected before we hand it back.
while(!zookeeper.getState().isConnected()) {
Threads.sleep(1);
if (stopWatch.elapsed(TimeUnit.MILLISECONDS) > timeout) {
throw new ZooKeeperConnectionException("Failed connect after waiting " +
stopWatch.elapsed(TimeUnit.MILLISECONDS) + "ms (zk session timeout); " +
zookeeper);
}
}
return zookeeper;
}
}
代码示例来源:origin: com.impetus.kundera.client/kundera-hbase
message = zkce.getMessage();
logger.error("Unable to connect to zookeeper, Caused by:", zkce);
代码示例来源:origin: co.cask.hbase/hbase
/**
* Get the ZooKeeper instance for this TableServers instance.
*
* If ZK has not been initialized yet, this will connect to ZK.
* @returns zookeeper reference
* @throws ZooKeeperConnectionException if there's a problem connecting to zk
*/
public synchronized ZooKeeperWatcher getZooKeeperWatcher()
throws ZooKeeperConnectionException {
if(zooKeeper == null) {
try {
this.zooKeeper = new ZooKeeperWatcher(conf, "hconnection", this);
} catch(ZooKeeperConnectionException zce) {
throw zce;
} catch (IOException e) {
throw new ZooKeeperConnectionException("An error is preventing" +
" HBase from connecting to ZooKeeper", e);
}
}
return zooKeeper;
}
代码示例来源:origin: com.impetus.client/kundera-hbase
message = zkce.getMessage();
logger.error("Unable to connect to zookeeper, Caused by:", zkce);
代码示例来源:origin: harbby/presto-connectors
zkw.getRecoverableZooKeeper().getZooKeeper().exists(zkw.baseZNode, false);
} catch (IOException e) {
throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e);
} catch (InterruptedException e) {
throw (InterruptedIOException)
new InterruptedIOException("Can't connect to ZooKeeper").initCause(e);
} catch (KeeperException e) {
throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e);
} finally {
if (zkw != null) {
代码示例来源:origin: harbby/presto-connectors
private void createBaseZNodes() throws ZooKeeperConnectionException {
try {
// Create all the necessary "directories" of znodes
ZKUtil.createWithParents(this, baseZNode);
if (conf.getBoolean("hbase.assignment.usezk", true)) {
ZKUtil.createAndFailSilent(this, assignmentZNode);
}
ZKUtil.createAndFailSilent(this, rsZNode);
ZKUtil.createAndFailSilent(this, drainingZNode);
ZKUtil.createAndFailSilent(this, tableZNode);
ZKUtil.createAndFailSilent(this, splitLogZNode);
ZKUtil.createAndFailSilent(this, backupMasterAddressesZNode);
ZKUtil.createAndFailSilent(this, tableLockZNode);
ZKUtil.createAndFailSilent(this, recoveringRegionsZNode);
} catch (KeeperException e) {
throw new ZooKeeperConnectionException(
prefix("Unexpected KeeperException creating base node"), e);
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
private void createBaseZNodes() throws ZooKeeperConnectionException {
try {
// Create all the necessary "directories" of znodes
ZKUtil2.createWithParents(this, baseZNode);
if (conf.getBoolean("hbase.assignment.usezk", true)) {
ZKUtil2.createAndFailSilent(this, assignmentZNode);
}
ZKUtil2.createAndFailSilent(this, rsZNode);
ZKUtil2.createAndFailSilent(this, drainingZNode);
ZKUtil2.createAndFailSilent(this, tableZNode);
ZKUtil2.createAndFailSilent(this, splitLogZNode);
ZKUtil2.createAndFailSilent(this, backupMasterAddressesZNode);
ZKUtil2.createAndFailSilent(this, tableLockZNode);
ZKUtil2.createAndFailSilent(this, recoveringRegionsZNode);
} catch (KeeperException e) {
throw new ZooKeeperConnectionException(
prefix("Unexpected KeeperException creating base node"), e);
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Ensure passed zookeeper is connected.
* @param timeout Time to wait on established Connection
*/
public static ZooKeeper ensureConnectedZooKeeper(ZooKeeper zookeeper, int timeout)
throws ZooKeeperConnectionException {
if (zookeeper.getState().isConnected()) {
return zookeeper;
}
Stopwatch stopWatch = Stopwatch.createStarted();
// Make sure we are connected before we hand it back.
while(!zookeeper.getState().isConnected()) {
Threads.sleep(1);
if (stopWatch.elapsed(TimeUnit.MILLISECONDS) > timeout) {
throw new ZooKeeperConnectionException("Failed connect after waiting " +
stopWatch.elapsed(TimeUnit.MILLISECONDS) + "ms (zk session timeout); " +
zookeeper);
}
}
return zookeeper;
}
}
代码示例来源:origin: harbby/presto-connectors
} catch (IOException e) {
ExceptionUtil.rethrowIfInterrupt(e);
throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e);
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
private void createBaseZNodes() throws ZooKeeperConnectionException {
try {
// Create all the necessary "directories" of znodes
ZKUtil.createWithParents(this, znodePaths.baseZNode);
ZKUtil.createAndFailSilent(this, znodePaths.rsZNode);
ZKUtil.createAndFailSilent(this, znodePaths.drainingZNode);
ZKUtil.createAndFailSilent(this, znodePaths.tableZNode);
ZKUtil.createAndFailSilent(this, znodePaths.splitLogZNode);
ZKUtil.createAndFailSilent(this, znodePaths.backupMasterAddressesZNode);
ZKUtil.createAndFailSilent(this, znodePaths.tableLockZNode);
ZKUtil.createAndFailSilent(this, znodePaths.masterMaintZNode);
} catch (KeeperException e) {
throw new ZooKeeperConnectionException(
prefix("Unexpected KeeperException creating base node"), e);
}
}
代码示例来源:origin: co.cask.hbase/hbase
private void createBaseZNodes() throws ZooKeeperConnectionException {
try {
// Create all the necessary "directories" of znodes
ZKUtil.createAndFailSilent(this, baseZNode);
ZKUtil.createAndFailSilent(this, assignmentZNode);
ZKUtil.createAndFailSilent(this, rsZNode);
ZKUtil.createAndFailSilent(this, drainingZNode);
ZKUtil.createAndFailSilent(this, masterTableZNode);
ZKUtil.createAndFailSilent(this, masterTableZNode92);
ZKUtil.createAndFailSilent(this, splitLogZNode);
ZKUtil.createAndFailSilent(this, backupMasterAddressesZNode);
} catch (KeeperException e) {
throw new ZooKeeperConnectionException(
prefix("Unexpected KeeperException creating base node"), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!