本文整理汇总了Java中org.apache.hadoop.ipc.RPC.getProtocolVersion方法的典型用法代码示例。如果您正苦于以下问题:Java RPC.getProtocolVersion方法的具体用法?Java RPC.getProtocolVersion怎么用?Java RPC.getProtocolVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.ipc.RPC
的用法示例。
在下文中一共展示了RPC.getProtocolVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNonHAProxyWithNuCypherExtClientProtocol
import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public static NuCypherExtClientProtocol createNonHAProxyWithNuCypherExtClientProtocol(
InetSocketAddress address, Configuration conf, UserGroupInformation ugi,
boolean withRetries, AtomicBoolean fallbackToSimpleAuth)
throws IOException {
RPC.setProtocolEngine(conf, NuCypherExtClientNamenodeProtocolPB.class,
ProtobufRpcEngine.class);
final RetryPolicy defaultPolicy = RetryPolicies.TRY_ONCE_THEN_FAIL;
/*
TODO do smth with 2.6 compatibility, because signature was changed
RetryUtils.getDefaultRetryPolicy(
conf,
HdfsClientConfigKeys.Retry.POLICY_ENABLED_KEY,
HdfsClientConfigKeys.Retry.POLICY_ENABLED_DEFAULT,
HdfsClientConfigKeys.Retry.POLICY_SPEC_KEY,
HdfsClientConfigKeys.Retry.POLICY_SPEC_DEFAULT,
SafeModeException.class)
// SafeModeException.class.getName());
*/
final long version = RPC.getProtocolVersion(NuCypherExtClientNamenodeProtocolPB.class);
NuCypherExtClientNamenodeProtocolPB proxy = RPC.getProtocolProxy(
NuCypherExtClientNamenodeProtocolPB.class, version, address, ugi, conf,
NetUtils.getDefaultSocketFactory(conf),
org.apache.hadoop.ipc.Client.getTimeout(conf), defaultPolicy,
fallbackToSimpleAuth).getProxy();
if (withRetries) { // create the proxy with retries
Map<String, RetryPolicy> methodNameToPolicyMap = new HashMap<>();
NuCypherExtClientProtocol translatorProxy =
new NuCypherExtClientNamenodeProtocolTranslatorPB(proxy);
return (NuCypherExtClientProtocol) RetryProxy.create(
NuCypherExtClientProtocol.class,
new DefaultFailoverProxyProvider<>(NuCypherExtClientProtocol.class,
translatorProxy),
methodNameToPolicyMap,
defaultPolicy);
} else {
return new NuCypherExtClientNamenodeProtocolTranslatorPB(proxy);
}
}
示例2: createNNProxyWithClientProtocol
import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
private static ClientProtocol createNNProxyWithClientProtocol(
InetSocketAddress address, Configuration conf, UserGroupInformation ugi,
boolean withRetries, AtomicBoolean fallbackToSimpleAuth)
throws IOException {
RPC.setProtocolEngine(conf, ClientNamenodeProtocolPB.class, ProtobufRpcEngine.class);
final RetryPolicy defaultPolicy =
RetryUtils.getDefaultRetryPolicy(
conf,
DFSConfigKeys.DFS_CLIENT_RETRY_POLICY_ENABLED_KEY,
DFSConfigKeys.DFS_CLIENT_RETRY_POLICY_ENABLED_DEFAULT,
DFSConfigKeys.DFS_CLIENT_RETRY_POLICY_SPEC_KEY,
DFSConfigKeys.DFS_CLIENT_RETRY_POLICY_SPEC_DEFAULT,
SafeModeException.class);
final long version = RPC.getProtocolVersion(ClientNamenodeProtocolPB.class);
ClientNamenodeProtocolPB proxy = RPC.getProtocolProxy(
ClientNamenodeProtocolPB.class, version, address, ugi, conf,
NetUtils.getDefaultSocketFactory(conf),
org.apache.hadoop.ipc.Client.getTimeout(conf), defaultPolicy,
fallbackToSimpleAuth).getProxy();
if (withRetries) { // create the proxy with retries
Map<String, RetryPolicy> methodNameToPolicyMap
= new HashMap<String, RetryPolicy>();
ClientProtocol translatorProxy =
new ClientNamenodeProtocolTranslatorPB(proxy);
return (ClientProtocol) RetryProxy.create(
ClientProtocol.class,
new DefaultFailoverProxyProvider<ClientProtocol>(
ClientProtocol.class, translatorProxy),
methodNameToPolicyMap,
defaultPolicy);
} else {
return new ClientNamenodeProtocolTranslatorPB(proxy);
}
}
示例3: getProtocolVersion
import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
@Override
public long getProtocolVersion(String protocol, long clientVersion)
throws IOException {
return RPC.getProtocolVersion(HAServiceProtocolPB.class);
}
示例4: getProtocolVersion
import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
@Override
public long getProtocolVersion(String protocol, long clientVersion)
throws IOException {
return RPC.getProtocolVersion(ZKFCProtocolPB.class);
}