本文整理汇总了Java中org.apache.hadoop.ipc.GenericRefreshProtocol类的典型用法代码示例。如果您正苦于以下问题:Java GenericRefreshProtocol类的具体用法?Java GenericRefreshProtocol怎么用?Java GenericRefreshProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GenericRefreshProtocol类属于org.apache.hadoop.ipc包,在下文中一共展示了GenericRefreshProtocol类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: GenericRefreshProtocolServerSideTranslatorPB
import org.apache.hadoop.ipc.GenericRefreshProtocol; //导入依赖的package包/类
public GenericRefreshProtocolServerSideTranslatorPB(
GenericRefreshProtocol impl) {
this.impl = impl;
}
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:5,代码来源:GenericRefreshProtocolServerSideTranslatorPB.java
示例2: genericRefresh
import org.apache.hadoop.ipc.GenericRefreshProtocol; //导入依赖的package包/类
public int genericRefresh(String[] argv, int i) throws IOException {
String hostport = argv[i++];
String identifier = argv[i++];
String[] args = Arrays.copyOfRange(argv, i, argv.length);
// Get the current configuration
Configuration conf = getConf();
// for security authorization
// server principal for this call
// should be NN's one.
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
conf.get(DFSConfigKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY, ""));
// Create the client
Class<?> xface = GenericRefreshProtocolPB.class;
InetSocketAddress address = NetUtils.createSocketAddr(hostport);
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
RPC.setProtocolEngine(conf, xface, ProtobufRpcEngine.class);
GenericRefreshProtocolPB proxy = (GenericRefreshProtocolPB)
RPC.getProxy(xface, RPC.getProtocolVersion(xface), address,
ugi, conf, NetUtils.getDefaultSocketFactory(conf), 0);
GenericRefreshProtocol xlator =
new GenericRefreshProtocolClientSideTranslatorPB(proxy);
// Refresh
Collection<RefreshResponse> responses = xlator.refresh(identifier, args);
int returnCode = 0;
// Print refresh responses
System.out.println("Refresh Responses:\n");
for (RefreshResponse response : responses) {
System.out.println(response.toString());
if (returnCode == 0 && response.getReturnCode() != 0) {
// This is the first non-zero return code, so we should return this
returnCode = response.getReturnCode();
} else if (returnCode != 0 && response.getReturnCode() != 0) {
// Then now we have multiple non-zero return codes,
// so we merge them into -1
returnCode = -1;
}
}
return returnCode;
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:50,代码来源:DFSAdmin.java
注:本文中的org.apache.hadoop.ipc.GenericRefreshProtocol类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论