当前位置: 首页>>代码示例>>Java>>正文


Java FileSystem.getDelegationToken方法代码示例

本文整理汇总了Java中org.apache.hadoop.fs.FileSystem.getDelegationToken方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.getDelegationToken方法的具体用法?Java FileSystem.getDelegationToken怎么用?Java FileSystem.getDelegationToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.fs.FileSystem的用法示例。


在下文中一共展示了FileSystem.getDelegationToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDTInInsecureCluster

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
@Test
public void testDTInInsecureCluster() throws Exception {
  MiniDFSCluster cluster = null;
  final Configuration conf = WebHdfsTestUtil.createConf();
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
    final FileSystem webHdfs = WebHdfsTestUtil.getWebHdfsFileSystem(conf,
        WebHdfsFileSystem.SCHEME);
    webHdfs.getDelegationToken(null);
    fail("No exception is thrown.");
  } catch (AccessControlException ace) {
    Assert.assertTrue(ace.getMessage().startsWith(
        WebHdfsFileSystem.CANT_FALLBACK_TO_INSECURE_MSG));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestWebHDFS.java

示例2: acquireDelegationToken

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
/**
 * Acquire the delegation token for the specified filesytem.
 * Before requesting a new delegation token, tries to find one already available.
 *
 * @param fs the filesystem that requires the delegation token
 * @throws IOException on fs.getDelegationToken() failure
 */
public void acquireDelegationToken(final FileSystem fs)
    throws IOException {
  if (userProvider.isHadoopSecurityEnabled()) {
    this.fs = fs;
    userToken = userProvider.getCurrent().getToken("HDFS_DELEGATION_TOKEN",
                                                    fs.getCanonicalServiceName());
    if (userToken == null) {
      hasForwardedToken = false;
      try {
        userToken = fs.getDelegationToken(renewer);
      } catch (NullPointerException npe) {
        // we need to handle NullPointerException in case HADOOP-10009 is missing
        LOG.error("Failed to get token for " + renewer);
      }
    } else {
      hasForwardedToken = true;
      LOG.info("Use the existing token: " + userToken);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:FsDelegationToken.java

示例3: testEmptyDelegationToken

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
@Test
public void testEmptyDelegationToken() throws IOException {
  Configuration conf = getTestConfiguration();
  MiniDFSCluster cluster = null;
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
    FileSystem fileSys = cluster.getFileSystem();
    fileSys.getDelegationToken("");
  } finally {
    cluster.shutdown();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestDistributedFileSystem.java


注:本文中的org.apache.hadoop.fs.FileSystem.getDelegationToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。