本文整理汇总了Java中org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSelector.selectHdfsDelegationToken方法的典型用法代码示例。如果您正苦于以下问题:Java DelegationTokenSelector.selectHdfsDelegationToken方法的具体用法?Java DelegationTokenSelector.selectHdfsDelegationToken怎么用?Java DelegationTokenSelector.selectHdfsDelegationToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSelector
的用法示例。
在下文中一共展示了DelegationTokenSelector.selectHdfsDelegationToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDelegationToken
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSelector; //导入方法依赖的package包/类
protected void initDelegationToken() throws IOException {
// look for webhdfs token, then try hdfs
final Text serviceName = SecurityUtil.buildTokenService(nnAddr);
Token<?> token = DT_SELECTOR.selectToken(serviceName, ugi.getTokens());
if (token == null) {
token = DelegationTokenSelector.selectHdfsDelegationToken(
nnAddr, ugi, getConf());
}
//since we don't already have a token, go get one
boolean createdToken = false;
if (token == null) {
token = getDelegationToken(null);
createdToken = (token != null);
}
// security might be disabled
if (token != null) {
setDelegationToken(token);
if (createdToken) {
addRenewAction(this);
LOG.debug("Created new DT for " + token.getService());
} else {
LOG.debug("Found existing DT for " + token.getService());
}
}
}
示例2: selectHdfsDelegationToken
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSelector; //导入方法依赖的package包/类
protected Token<DelegationTokenIdentifier> selectHdfsDelegationToken() {
return DelegationTokenSelector.selectHdfsDelegationToken(
nnAddr, ugi, getConf());
}