當前位置: 首頁>>代碼示例>>Java>>正文


Java Token.renew方法代碼示例

本文整理匯總了Java中org.apache.hadoop.security.token.Token.renew方法的典型用法代碼示例。如果您正苦於以下問題:Java Token.renew方法的具體用法?Java Token.renew怎麽用?Java Token.renew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.security.token.Token的用法示例。


在下文中一共展示了Token.renew方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renewDelegationToken

import org.apache.hadoop.security.token.Token; //導入方法依賴的package包/類
/**
 * Renew a delegation token
 * @param token the token to renew
 * @return the new expiration time
 * @throws InvalidToken
 * @throws IOException
 * @deprecated Use Token.renew instead.
 */
@Deprecated
public long renewDelegationToken(Token<DelegationTokenIdentifier> token)
    throws InvalidToken, IOException {
  LOG.info("Renewing " + DelegationTokenIdentifier.stringifyToken(token));
  try {
    return token.renew(conf);
  } catch (InterruptedException ie) {                                       
    throw new RuntimeException("caught interrupted", ie);
  } catch (RemoteException re) {
    throw re.unwrapRemoteException(InvalidToken.class,
                                   AccessControlException.class);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:22,代碼來源:DFSClient.java

示例2: testSecureHAToken

import org.apache.hadoop.security.token.Token; //導入方法依賴的package包/類
@Test
public void testSecureHAToken() throws IOException, InterruptedException {
  Configuration conf = DFSTestUtil.newHAConfiguration(LOGICAL_NAME);
  conf.setBoolean(DFSConfigKeys
          .DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY, true);

  MiniDFSCluster cluster = null;
  WebHdfsFileSystem fs = null;
  try {
    cluster = new MiniDFSCluster.Builder(conf).nnTopology(topo)
        .numDataNodes(0).build();

    HATestUtil.setFailoverConfigurations(cluster, conf, LOGICAL_NAME);
    cluster.waitActive();

    fs = spy((WebHdfsFileSystem) FileSystem.get(WEBHDFS_URI, conf));
    FileSystemTestHelper.addFileSystemForTesting(WEBHDFS_URI, conf, fs);

    cluster.transitionToActive(0);
    Token<?> token = fs.getDelegationToken(null);

    cluster.shutdownNameNode(0);
    cluster.transitionToActive(1);
    token.renew(conf);
    token.cancel(conf);
    verify(fs).renewDelegationToken(token);
    verify(fs).cancelDelegationToken(token);
  } finally {
    IOUtils.cleanup(null, fs);
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:35,代碼來源:TestWebHDFSForHA.java

示例3: testDFSGetCanonicalServiceName

import org.apache.hadoop.security.token.Token; //導入方法依賴的package包/類
/**
 * HDFS-3062: DistributedFileSystem.getCanonicalServiceName() throws an
 * exception if the URI is a logical URI. This bug fails the combination of
 * ha + mapred + security.
 */
@Test(timeout = 300000)
public void testDFSGetCanonicalServiceName() throws Exception {
  URI hAUri = HATestUtil.getLogicalUri(cluster);
  String haService = HAUtil.buildTokenServiceForLogicalUri(hAUri,
      HdfsConstants.HDFS_URI_SCHEME).toString();
  assertEquals(haService, dfs.getCanonicalServiceName());
  final String renewer = UserGroupInformation.getCurrentUser().getShortUserName();
  final Token<DelegationTokenIdentifier> token =
      getDelegationToken(dfs, renewer);
  assertEquals(haService, token.getService().toString());
  // make sure the logical uri is handled correctly
  token.renew(dfs.getConf());
  token.cancel(dfs.getConf());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:TestDelegationTokensWithHA.java

示例4: testHdfsGetCanonicalServiceName

import org.apache.hadoop.security.token.Token; //導入方法依賴的package包/類
@Test(timeout = 300000)
public void testHdfsGetCanonicalServiceName() throws Exception {
  Configuration conf = dfs.getConf();
  URI haUri = HATestUtil.getLogicalUri(cluster);
  AbstractFileSystem afs =  AbstractFileSystem.createFileSystem(haUri, conf);    
  String haService = HAUtil.buildTokenServiceForLogicalUri(haUri,
      HdfsConstants.HDFS_URI_SCHEME).toString();
  assertEquals(haService, afs.getCanonicalServiceName());
  Token<?> token = afs.getDelegationTokens(
      UserGroupInformation.getCurrentUser().getShortUserName()).get(0);
  assertEquals(haService, token.getService().toString());
  // make sure the logical uri is handled correctly
  token.renew(conf);
  token.cancel(conf);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:16,代碼來源:TestDelegationTokensWithHA.java

示例5: renewDelegationToken

import org.apache.hadoop.security.token.Token; //導入方法依賴的package包/類
/**
 * Renew a delegation token
 * @param token the token to renew
 * @return true if the renewal went well
 * @throws InvalidToken
 * @throws IOException
 * @deprecated Use {@link Token#renew} instead
 */
public long renewDelegationToken(Token<DelegationTokenIdentifier> token
                                 ) throws InvalidToken, IOException, 
                                          InterruptedException {
  return token.renew(getConf());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:14,代碼來源:JobClient.java

示例6: renewDelegationToken

import org.apache.hadoop.security.token.Token; //導入方法依賴的package包/類
/**
 * Renew a delegation token
 * @param token the token to renew
 * @return the new expiration time
 * @throws InvalidToken
 * @throws IOException
 * @deprecated Use {@link Token#renew} instead
 */
public long renewDelegationToken(Token<DelegationTokenIdentifier> token
                                 ) throws InvalidToken, IOException,
                                          InterruptedException {
  return token.renew(getConf());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:14,代碼來源:Cluster.java


注:本文中的org.apache.hadoop.security.token.Token.renew方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。