本文整理汇总了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()");
}
}
示例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()");
}
}
示例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()");
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}