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


Java Methods类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.Methods的典型用法代码示例。如果您正苦于以下问题:Java Methods类的具体用法?Java Methods怎么用?Java Methods使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Methods类属于org.apache.hadoop.hbase.util包,在下文中一共展示了Methods类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: obtainAuthTokenForJob

import org.apache.hadoop.hbase.util.Methods; //导入依赖的package包/类
@Override
public void obtainAuthTokenForJob(Configuration conf, Job job)
    throws IOException, InterruptedException {
  try {
    Class<?> c = Class.forName(
        "org.apache.hadoop.hbase.security.token.TokenUtil");
    Methods.call(c, null, "obtainTokenForJob",
        new Class[]{Configuration.class, UserGroupInformation.class,
            Job.class},
        new Object[]{conf, ugi, job});
  } catch (ClassNotFoundException cnfe) {
    throw new RuntimeException("Failure loading TokenUtil class, "
        +"is secure RPC available?", cnfe);
  } catch (IOException ioe) {
    throw ioe;
  } catch (InterruptedException ie) {
    throw ie;
  } catch (RuntimeException re) {
    throw re;
  } catch (Exception e) {
    throw new UndeclaredThrowableException(e,
        "Unexpected error calling TokenUtil.obtainAndCacheToken()");
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:User.java

示例2: obtainAuthTokenForJob

import org.apache.hadoop.hbase.util.Methods; //导入依赖的package包/类
@Override
public void obtainAuthTokenForJob(Configuration conf, Job job)
    throws IOException, InterruptedException {
  try {
    Class c = Class.forName(
        "org.apache.hadoop.hbase.security.token.TokenUtil");
    Methods.call(c, null, "obtainTokenForJob",
        new Class[]{Configuration.class, UserGroupInformation.class,
            Job.class},
        new Object[]{conf, ugi, job});
  } catch (ClassNotFoundException cnfe) {
    throw new RuntimeException("Failure loading TokenUtil class, "
        +"is secure RPC available?", cnfe);
  } catch (IOException ioe) {
    throw ioe;
  } catch (InterruptedException ie) {
    throw ie;
  } catch (RuntimeException re) {
    throw re;
  } catch (Exception e) {
    throw new UndeclaredThrowableException(e,
        "Unexpected error calling TokenUtil.obtainAndCacheToken()");
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:25,代码来源:User.java

示例3: login

import org.apache.hadoop.hbase.util.Methods; //导入依赖的package包/类
/**
 * Obtain credentials for the current process using the configured
 * Kerberos keytab file and principal.
 * @see User#login(org.apache.hadoop.conf.Configuration, String, String, String)
 *
 * @param conf the Configuration to use
 * @param fileConfKey Configuration property key used to store the path
 * to the keytab file
 * @param principalConfKey Configuration property key used to store the
 * principal name to login as
 * @param localhost the local hostname
 */
public static void login(Configuration conf, String fileConfKey,
    String principalConfKey, String localhost) throws IOException {
  if (isSecurityEnabled()) {
    // check for SecurityUtil class
    try {
      Class c = Class.forName("org.apache.hadoop.security.SecurityUtil");
      Class[] types = new Class[]{
          Configuration.class, String.class, String.class, String.class };
      Object[] args = new Object[]{
          conf, fileConfKey, principalConfKey, localhost };
      Methods.call(c, null, "login", types, args);
    } catch (ClassNotFoundException cnfe) {
      throw new RuntimeException("Unable to login using " +
          "org.apache.hadoop.security.SecurityUtil.login(). SecurityUtil class " +
          "was not found!  Is this a version of secure Hadoop?", cnfe);
    } catch (IOException ioe) {
      throw ioe;
    } catch (RuntimeException re) {
      throw re;
    } catch (Exception e) {
      throw new UndeclaredThrowableException(e,
          "Unhandled exception in User.login()");
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:38,代码来源:User.java

示例4: runAsLoginUser

import org.apache.hadoop.hbase.util.Methods; //导入依赖的package包/类
/**
 * Executes the given action as the login user
 * @param action
 * @return the result of the action
 * @throws IOException
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> T runAsLoginUser(PrivilegedExceptionAction<T> action) throws IOException {
  try {
    Class c = Class.forName("org.apache.hadoop.security.SecurityUtil");
    Class [] types = new Class[]{PrivilegedExceptionAction.class};
    Object[] args = new Object[]{action};
    return (T) Methods.call(c, null, "doAsLoginUser", types, args);
  } catch (Throwable e) {
    throw new IOException(e);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:User.java

示例5: prepareBulkLoad

import org.apache.hadoop.hbase.util.Methods; //导入依赖的package包/类
public String prepareBulkLoad(byte[] tableName) throws IOException {
  try {
    String bulkToken = (String) Methods.call(protocolClazz, proxy,
        "prepareBulkLoad", new Class[]{byte[].class}, new Object[]{tableName});
    return bulkToken;
  } catch (Exception e) {
    throw new IOException("Failed to prepareBulkLoad", e);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:SecureBulkLoadClient.java

示例6: cleanupBulkLoad

import org.apache.hadoop.hbase.util.Methods; //导入依赖的package包/类
public void cleanupBulkLoad(String bulkToken) throws IOException {
  try {
    Methods.call(protocolClazz, proxy,
        "cleanupBulkLoad", new Class[]{String.class},new Object[]{bulkToken});
  } catch (Exception e) {
    throw new IOException("Failed to prepareBulkLoad", e);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:9,代码来源:SecureBulkLoadClient.java


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