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()); } } }
protected Token<DelegationTokenIdentifier> selectHdfsDelegationToken() { return DelegationTokenSelector.selectHdfsDelegationToken( nnAddr, ugi, getConf()); }