本文整理匯總了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);
}