本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.keeperException()
方法的一些代码示例,展示了ZooKeeperWatcher.keeperException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperWatcher.keeperException()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher
类名称:ZooKeeperWatcher
方法名:keeperException
[英]Handles KeeperExceptions in client calls.
This may be temporary but for now this gives one place to deal with these.
TODO: Currently this method rethrows the exception to let the caller handle
[中]处理客户端调用中的KeeperException。
这可能是暂时的,但就目前而言,这为解决这些问题提供了一个空间。
TODO:当前,此方法重新引发异常,以让调用方处理
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Get znode data. Does not set a watcher.
* @return ZNode data, null if the node does not exist or if there is an
* error.
*/
public static byte [] getData(ZooKeeperWatcher zkw, String znode)
throws KeeperException, InterruptedException {
try {
byte [] data = zkw.getRecoverableZooKeeper2().getData(znode, null, null);
// logRetrievedMsg(zkw, znode, data, false);
return data;
} catch (KeeperException.NoNodeException e) {
LOG.debug(zkw.prefix("Unable to get data of znode " + znode + " " +
"because node does not exist (not an error)"));
return null;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to list children of znode " + znode), e);
zkw.keeperException(e);
return false;
} catch (InterruptedException e) {
代码示例来源:origin: com.aliyun.hbase/alihbase-client
private static byte[] getDataInternal(ZooKeeperWatcher zkw, String znode, Stat stat,
boolean watcherSet)
throws KeeperException {
try {
byte [] data = zkw.getRecoverableZooKeeper2().getData(znode, zkw, stat);
// logRetrievedMsg(zkw, znode, data, watcherSet);
return data;
} catch (KeeperException.NoNodeException e) {
// This log can get pretty annoying when we cycle on 100ms waits.
// Enable trace if you really want to see it.
LOG.trace(zkw.prefix("Unable to get data of znode " + znode + " " +
"because node does not exist (not an error)"));
return null;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.interruptedException(e);
return null;
}
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* Get znode data. Does not set a watcher.
* @return ZNode data
*/
public static byte [] getData(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
byte [] data = zkw.getRecoverableZooKeeper().getData(znode, null, null);
logRetrievedMsg(zkw, znode, data, false);
return data;
} catch (KeeperException.NoNodeException e) {
LOG.debug(zkw.prefix("Unable to get data of znode " + znode + " " +
"because node does not exist (not an error)"));
return null;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.interruptedException(e);
return null;
}
}
代码示例来源:origin: co.cask.hbase/hbase
private static byte[] getDataInternal(ZooKeeperWatcher zkw, String znode, Stat stat,
boolean watcherSet)
throws KeeperException {
try {
byte [] data = zkw.getRecoverableZooKeeper().getData(znode, zkw, stat);
logRetrievedMsg(zkw, znode, data, watcherSet);
return data;
} catch (KeeperException.NoNodeException e) {
LOG.debug(zkw.prefix("Unable to get data of znode " + znode + " " +
"because node does not exist (not an error)"));
return null;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.interruptedException(e);
return null;
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Check if the specified node exists. Sets no watches.
*
* @param zkw zk reference
* @param znode path of node to watch
* @return version of the node if it exists, -1 if does not exist
* @throws KeeperException if unexpected zookeeper exception
*/
public static int checkExists(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
Stat s = zkw.getRecoverableZooKeeper2().exists(znode, null);
return s != null ? s.getVersion() : -1;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode (" + znode + ")"), e);
zkw.keeperException(e);
return -1;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode (" + znode + ")"), e);
zkw.interruptedException(e);
return -1;
}
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* Check if the specified node exists. Sets no watches.
*
* @param zkw zk reference
* @param znode path of node to watch
* @return version of the node if it exists, -1 if does not exist
* @throws KeeperException if unexpected zookeeper exception
*/
public static int checkExists(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
Stat s = zkw.getRecoverableZooKeeper().exists(znode, null);
return s != null ? s.getVersion() : -1;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode (" + znode + ")"), e);
zkw.keeperException(e);
return -1;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode (" + znode + ")"), e);
zkw.interruptedException(e);
return -1;
}
}
代码示例来源:origin: co.cask.hbase/hbase
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode " + znode), e);
zkw.keeperException(e);
return false;
} catch (InterruptedException e) {
代码示例来源:origin: com.aliyun.hbase/alihbase-client
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode " + znode), e);
zkw.keeperException(e);
return false;
} catch (InterruptedException e) {
代码示例来源:origin: co.cask.hbase/hbase
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to list children of znode " + znode + " "), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
代码示例来源:origin: com.aliyun.hbase/alihbase-client
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
代码示例来源:origin: co.cask.hbase/hbase
/**
* Get the number of children of the specified node.
*
* If the node does not exist or has no children, returns 0.
*
* Sets no watches at all.
*
* @param zkw zk reference
* @param znode path of node to count children of
* @return number of children of specified node, 0 if none or parent does not
* exist
* @throws KeeperException if unexpected zookeeper exception
*/
public static int getNumberOfChildren(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
Stat stat = zkw.getRecoverableZooKeeper().exists(znode, null);
return stat == null ? 0 : stat.getNumChildren();
} catch(KeeperException e) {
LOG.warn(zkw.prefix("Unable to get children of node " + znode));
zkw.keeperException(e);
} catch(InterruptedException e) {
zkw.interruptedException(e);
}
return 0;
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Get the number of children of the specified node.
*
* If the node does not exist or has no children, returns 0.
*
* Sets no watches at all.
*
* @param zkw zk reference
* @param znode path of node to count children of
* @return number of children of specified node, 0 if none or parent does not
* exist
* @throws KeeperException if unexpected zookeeper exception
*/
public static int getNumberOfChildren(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
Stat stat = zkw.getRecoverableZooKeeper2().exists(znode, null);
return stat == null ? 0 : stat.getNumChildren();
} catch(KeeperException e) {
LOG.warn(zkw.prefix("Unable to get children of node " + znode));
zkw.keeperException(e);
} catch(InterruptedException e) {
zkw.interruptedException(e);
}
return 0;
}
代码示例来源:origin: co.cask.hbase/hbase
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
代码示例来源:origin: harbby/presto-connectors
/**
* Get the number of children of the specified node.
*
* If the node does not exist or has no children, returns 0.
*
* Sets no watches at all.
*
* @param zkw zk reference
* @param znode path of node to count children of
* @return number of children of specified node, 0 if none or parent does not
* exist
* @throws KeeperException if unexpected zookeeper exception
*/
public static int getNumberOfChildren(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
Stat stat = zkw.getRecoverableZooKeeper().exists(znode, null);
return stat == null ? 0 : stat.getNumChildren();
} catch(KeeperException e) {
LOG.warn(zkw.prefix("Unable to get children of node " + znode));
zkw.keeperException(e);
} catch(InterruptedException e) {
zkw.interruptedException(e);
}
return 0;
}
代码示例来源:origin: harbby/presto-connectors
/**
* Get znode data. Does not set a watcher.
* @return ZNode data, null if the node does not exist or if there is an
* error.
*/
public static byte [] getData(ZooKeeperWatcher zkw, String znode)
throws KeeperException, InterruptedException {
try {
byte [] data = zkw.getRecoverableZooKeeper().getData(znode, null, null);
logRetrievedMsg(zkw, znode, data, false);
return data;
} catch (KeeperException.NoNodeException e) {
LOG.debug(zkw.prefix("Unable to get data of znode " + znode + " " +
"because node does not exist (not an error)"));
return null;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* Check if the specified node exists. Sets no watches.
*
* @param zkw zk reference
* @param znode path of node to watch
* @return version of the node if it exists, -1 if does not exist
* @throws KeeperException if unexpected zookeeper exception
*/
public static int checkExists(ZooKeeperWatcher zkw, String znode)
throws KeeperException {
try {
Stat s = zkw.getRecoverableZooKeeper().exists(znode, null);
return s != null ? s.getVersion() : -1;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode (" + znode + ")"), e);
zkw.keeperException(e);
return -1;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode (" + znode + ")"), e);
zkw.interruptedException(e);
return -1;
}
}
代码示例来源:origin: harbby/presto-connectors
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to list children of znode " + znode + " "), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
代码示例来源:origin: harbby/presto-connectors
private static byte[] getDataInternal(ZooKeeperWatcher zkw, String znode, Stat stat,
boolean watcherSet)
throws KeeperException {
try {
byte [] data = zkw.getRecoverableZooKeeper().getData(znode, zkw, stat);
logRetrievedMsg(zkw, znode, data, watcherSet);
return data;
} catch (KeeperException.NoNodeException e) {
// This log can get pretty annoying when we cycle on 100ms waits.
// Enable trace if you really want to see it.
LOG.trace(zkw.prefix("Unable to get data of znode " + znode + " " +
"because node does not exist (not an error)"));
return null;
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.keeperException(e);
return null;
} catch (InterruptedException e) {
LOG.warn(zkw.prefix("Unable to get data of znode " + znode), e);
zkw.interruptedException(e);
return null;
}
}
代码示例来源:origin: harbby/presto-connectors
} catch (KeeperException e) {
LOG.warn(zkw.prefix("Unable to set watcher on znode " + znode), e);
zkw.keeperException(e);
return false;
} catch (InterruptedException e) {
内容来源于网络,如有侵权,请联系作者删除!