當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。