本文整理汇总了Java中org.apache.hadoop.hbase.util.Methods.call方法的典型用法代码示例。如果您正苦于以下问题:Java Methods.call方法的具体用法?Java Methods.call怎么用?Java Methods.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.util.Methods
的用法示例。
在下文中一共展示了Methods.call方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: obtainAuthTokenForJob
import org.apache.hadoop.hbase.util.Methods; //导入方法依赖的package包/类
@Override
public void obtainAuthTokenForJob(JobConf job)
throws IOException, InterruptedException {
try {
Class c = Class.forName(
"org.apache.hadoop.hbase.security.token.TokenUtil");
Methods.call(c, null, "obtainTokenForJob",
new Class[]{JobConf.class, UserGroupInformation.class},
new Object[]{job, ugi});
} 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()");
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: bulkLoadHFiles
import org.apache.hadoop.hbase.util.Methods; //导入方法依赖的package包/类
public boolean bulkLoadHFiles(List<Pair<byte[], String>> familyPaths, Token<?> userToken,
String bulkToken, boolean assignSeqNum) throws IOException {
try {
return (Boolean) Methods.call(protocolClazz, proxy, "bulkLoadHFiles", new Class[] {
List.class, Token.class, String.class, Boolean.class },
new Object[] { familyPaths, userToken, bulkToken, assignSeqNum });
} catch (Exception e) {
throw new IOException("Failed to bulkLoadHFiles", e);
}
}
示例9: getStagingPath
import org.apache.hadoop.hbase.util.Methods; //导入方法依赖的package包/类
public Path getStagingPath(String bulkToken, byte[] family) throws IOException {
try {
return (Path)Methods.call(endpointClazz, null, "getStagingPath",
new Class[]{Configuration.class, String.class, byte[].class},
new Object[]{table.getConfiguration(), bulkToken, family});
} catch (Exception e) {
throw new IOException("Failed to getStagingPath", e);
}
}
示例10: 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
* @throws InterruptedException
*/
@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);
}
}
示例11: bulkLoadHFiles
import org.apache.hadoop.hbase.util.Methods; //导入方法依赖的package包/类
public boolean bulkLoadHFiles(List<Pair<byte[], String>> familyPaths,
Token<?> userToken, String bulkToken) throws IOException {
try {
return (Boolean)Methods.call(protocolClazz, proxy, "bulkLoadHFiles",
new Class[]{List.class, Token.class, String.class},new Object[]{familyPaths, userToken, bulkToken});
} catch (Exception e) {
throw new IOException("Failed to bulkLoadHFiles", e);
}
}
示例12: newServiceStub
import org.apache.hadoop.hbase.util.Methods; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends Service> T newServiceStub(Class<T> service, RpcChannel channel)
throws Exception {
return (T)Methods.call(service, null, "newStub",
new Class[]{ RpcChannel.class }, new Object[]{ channel });
}
示例13: call
import org.apache.hadoop.hbase.util.Methods; //导入方法依赖的package包/类
private static Object call(UserGroupInformation instance, String methodName,
Class[] types, Object[] args) throws Exception {
return Methods.call(UserGroupInformation.class, instance, methodName, types,
args);
}