当前位置: 首页>>代码示例>>Java>>正文


Java RPC.getProtocolVersion方法代码示例

本文整理汇总了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);
    }
  }
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:41,代码来源:NuCypherExtNameNodeProxiesClient.java

示例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);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:NameNodeProxies.java

示例3: getProtocolVersion

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
@Override
public long getProtocolVersion(String protocol, long clientVersion)
    throws IOException {
  return RPC.getProtocolVersion(HAServiceProtocolPB.class);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:6,代码来源:HAServiceProtocolServerSideTranslatorPB.java

示例4: getProtocolVersion

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
@Override
public long getProtocolVersion(String protocol, long clientVersion)
    throws IOException {
  return RPC.getProtocolVersion(ZKFCProtocolPB.class);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:6,代码来源:ZKFCProtocolServerSideTranslatorPB.java


注:本文中的org.apache.hadoop.ipc.RPC.getProtocolVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。