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


Java RPC.setProtocolEngine方法代码示例

本文整理汇总了Java中org.apache.hadoop.ipc.RPC.setProtocolEngine方法的典型用法代码示例。如果您正苦于以下问题:Java RPC.setProtocolEngine方法的具体用法?Java RPC.setProtocolEngine怎么用?Java RPC.setProtocolEngine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.ipc.RPC的用法示例。


在下文中一共展示了RPC.setProtocolEngine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ZKFCProtocolClientSideTranslatorPB

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public ZKFCProtocolClientSideTranslatorPB(
    InetSocketAddress addr, Configuration conf,
    SocketFactory socketFactory, int timeout) throws IOException {
  RPC.setProtocolEngine(conf, ZKFCProtocolPB.class,
      ProtobufRpcEngine.class);
  rpcProxy = RPC.getProxy(ZKFCProtocolPB.class,
      RPC.getProtocolVersion(ZKFCProtocolPB.class), addr,
      UserGroupInformation.getCurrentUser(), conf, socketFactory, timeout);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:ZKFCProtocolClientSideTranslatorPB.java

示例2: createClientDatanodeProtocolProxy

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
static ClientDatanodeProtocolPB createClientDatanodeProtocolProxy(
    InetSocketAddress addr, UserGroupInformation ticket, Configuration conf,
    SocketFactory factory, int socketTimeout) throws IOException {
  RPC.setProtocolEngine(conf, ClientDatanodeProtocolPB.class,
      ProtobufRpcEngine.class);
  return RPC.getProxy(ClientDatanodeProtocolPB.class,
      RPC.getProtocolVersion(ClientDatanodeProtocolPB.class), addr, ticket,
      conf, factory, socketTimeout);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ClientDatanodeProtocolTranslatorPB.java

示例3: ZKFCRpcServer

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
ZKFCRpcServer(Configuration conf,
    InetSocketAddress bindAddr,
    ZKFailoverController zkfc,
    PolicyProvider policy) throws IOException {
  this.zkfc = zkfc;
  
  RPC.setProtocolEngine(conf, ZKFCProtocolPB.class,
      ProtobufRpcEngine.class);
  ZKFCProtocolServerSideTranslatorPB translator =
      new ZKFCProtocolServerSideTranslatorPB(this);
  BlockingService service = ZKFCProtocolService
      .newReflectiveBlockingService(translator);
  this.server = new RPC.Builder(conf).setProtocol(ZKFCProtocolPB.class)
      .setInstance(service).setBindAddress(bindAddr.getHostName())
      .setPort(bindAddr.getPort()).setNumHandlers(HANDLER_COUNT)
      .setVerbose(false).build();
  
  // set service-level authorization security policy
  if (conf.getBoolean(
      CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) {
    server.refreshServiceAcl(conf, policy);
  }

}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:ZKFCRpcServer.java

示例4: createMockDatanode

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
private static Server createMockDatanode(BlockTokenSecretManager sm,
    Token<BlockTokenIdentifier> token, Configuration conf)
    throws IOException, ServiceException {
  ClientDatanodeProtocolPB mockDN = mock(ClientDatanodeProtocolPB.class);

  BlockTokenIdentifier id = sm.createIdentifier();
  id.readFields(new DataInputStream(new ByteArrayInputStream(token
      .getIdentifier())));
  
  doAnswer(new GetLengthAnswer(sm, id)).when(mockDN)
      .getReplicaVisibleLength(any(RpcController.class),
          any(GetReplicaVisibleLengthRequestProto.class));

  RPC.setProtocolEngine(conf, ClientDatanodeProtocolPB.class,
      ProtobufRpcEngine.class);
  BlockingService service = ClientDatanodeProtocolService
      .newReflectiveBlockingService(mockDN);
  return new RPC.Builder(conf).setProtocol(ClientDatanodeProtocolPB.class)
      .setInstance(service).setBindAddress(ADDRESS).setPort(0)
      .setNumHandlers(5).setVerbose(true).setSecretManager(sm).build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestBlockToken.java

示例5: newRpcServer

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
private static RPC.Server newRpcServer(
    RaftServerProtocol serverProtocol, final Configuration conf)
    throws IOException {
  final int handlerCount = HadoopConfigKeys.Ipc.handlers(conf);
  final InetSocketAddress address = HadoopConfigKeys.Ipc.address(conf);

  final BlockingService service
      = RaftServerProtocolService.newReflectiveBlockingService(
          new RaftServerProtocolServerSideTranslatorPB(serverProtocol));
  RPC.setProtocolEngine(conf, RaftServerProtocolPB.class, ProtobufRpcEngineShaded.class);
  return new RPC.Builder(conf)
      .setProtocol(RaftServerProtocolPB.class)
      .setInstance(service)
      .setBindAddress(address.getHostName())
      .setPort(address.getPort())
      .setNumHandlers(handlerCount)
      .setVerbose(false)
      .build();
}
 
开发者ID:apache,项目名称:incubator-ratis,代码行数:20,代码来源:HadoopRpcService.java

示例6: createProxy

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
protected QJournalProtocol createProxy() throws IOException {
  final Configuration confCopy = new Configuration(conf);
  
  // Need to set NODELAY or else batches larger than MTU can trigger 
  // 40ms nagling delays.
  confCopy.setBoolean(
      CommonConfigurationKeysPublic.IPC_CLIENT_TCPNODELAY_KEY,
      true);
  
  RPC.setProtocolEngine(confCopy,
      QJournalProtocolPB.class, ProtobufRpcEngine.class);
  return SecurityUtil.doAsLoginUser(
      new PrivilegedExceptionAction<QJournalProtocol>() {
        @Override
        public QJournalProtocol run() throws IOException {
          RPC.setProtocolEngine(confCopy,
              QJournalProtocolPB.class, ProtobufRpcEngine.class);
          QJournalProtocolPB pbproxy = RPC.getProxy(
              QJournalProtocolPB.class,
              RPC.getProtocolVersion(QJournalProtocolPB.class),
              addr, confCopy);
          return new QJournalProtocolTranslatorPB(pbproxy);
        }
      });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:IPCLoggerChannel.java

示例7: HSClientProtocolPBClientImpl

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public HSClientProtocolPBClientImpl(long clientVersion,
    InetSocketAddress addr, Configuration conf) throws IOException {
  super();
  RPC.setProtocolEngine(conf, HSClientProtocolPB.class,
      ProtobufRpcEngine.class);
  proxy = (HSClientProtocolPB)RPC.getProxy(
      HSClientProtocolPB.class, clientVersion, addr, conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:HSClientProtocolPBClientImpl.java

示例8: SCMUploaderProtocolPBClientImpl

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public SCMUploaderProtocolPBClientImpl(long clientVersion,
    InetSocketAddress addr, Configuration conf) throws IOException {
  RPC.setProtocolEngine(conf, SCMUploaderProtocolPB.class,
    ProtobufRpcEngine.class);
  proxy =
      RPC.getProxy(SCMUploaderProtocolPB.class, clientVersion, addr, conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:SCMUploaderProtocolPBClientImpl.java

示例9: 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

示例10: DatanodeProtocolClientSideTranslatorPB

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public DatanodeProtocolClientSideTranslatorPB(InetSocketAddress nameNodeAddr,
    Configuration conf) throws IOException {
  RPC.setProtocolEngine(conf, DatanodeProtocolPB.class,
      ProtobufRpcEngine.class);
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
  rpcProxy = createNamenode(nameNodeAddr, conf, ugi);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:DatanodeProtocolClientSideTranslatorPB.java

示例11: ApplicationHistoryProtocolPBClientImpl

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public ApplicationHistoryProtocolPBClientImpl(long clientVersion,
    InetSocketAddress addr, Configuration conf) throws IOException {
  RPC.setProtocolEngine(conf, ApplicationHistoryProtocolPB.class,
    ProtobufRpcEngine.class);
  proxy =
      RPC.getProxy(ApplicationHistoryProtocolPB.class, clientVersion, addr,
        conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:ApplicationHistoryProtocolPBClientImpl.java

示例12: HAServiceProtocolClientSideTranslatorPB

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
public HAServiceProtocolClientSideTranslatorPB(InetSocketAddress addr,
    Configuration conf) throws IOException {
  RPC.setProtocolEngine(conf, HAServiceProtocolPB.class,
      ProtobufRpcEngine.class);
  rpcProxy = RPC.getProxy(HAServiceProtocolPB.class,
      RPC.getProtocolVersion(HAServiceProtocolPB.class), addr, conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:HAServiceProtocolClientSideTranslatorPB.java

示例13: createHSProxy

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
private static Object createHSProxy(InetSocketAddress address,
    Configuration conf, UserGroupInformation ugi, Class<?> xface,
    int rpcTimeout) throws IOException {
  RPC.setProtocolEngine(conf, xface, ProtobufRpcEngine.class);
  Object proxy = RPC.getProxy(xface, RPC.getProtocolVersion(xface), address,
      ugi, conf, NetUtils.getDefaultSocketFactory(conf), rpcTimeout);
  return proxy;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:HSProxies.java

示例14: createNameNodeProxy

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
private static Object createNameNodeProxy(InetSocketAddress address,
    Configuration conf, UserGroupInformation ugi, Class<?> xface)
    throws IOException {
  RPC.setProtocolEngine(conf, xface, ProtobufRpcEngine.class);
  Object proxy = RPC.getProxy(xface, RPC.getProtocolVersion(xface), address,
      ugi, conf, NetUtils.getDefaultSocketFactory(conf));
  return proxy;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:NameNodeProxies.java

示例15: run

import org.apache.hadoop.ipc.RPC; //导入方法依赖的package包/类
@Override
public int run(String argv[]) throws Exception {
  LinkedList<String> args = new LinkedList<String>();
  for (String arg : argv) {
    args.add(arg);
  }
  if (StringUtils.popOption("-h", args) ||
      StringUtils.popOption("-help", args)) {
    usage();
    return 0;
  } else if (args.size() == 0) {
    usage();
    return 0;
  }
  String hostPort = StringUtils.popOptionWithArgument("-host", args);
  if (hostPort == null) {
    System.err.println("You must specify a host with -host.");
    return 1;
  }
  if (args.size() < 0) {
    System.err.println("You must specify an operation.");
    return 1;
  }
  RPC.setProtocolEngine(getConf(), TraceAdminProtocolPB.class,
      ProtobufRpcEngine.class);
  InetSocketAddress address = NetUtils.createSocketAddr(hostPort);
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
  Class<?> xface = TraceAdminProtocolPB.class;
  proxy = (TraceAdminProtocolPB)RPC.getProxy(xface,
      RPC.getProtocolVersion(xface), address,
      ugi, getConf(), NetUtils.getDefaultSocketFactory(getConf()), 0);
  remote = new TraceAdminProtocolTranslatorPB(proxy);
  try {
    if (args.get(0).equals("-list")) {
      return listSpanReceivers(args.subList(1, args.size()));
    } else if (args.get(0).equals("-add")) {
      return addSpanReceiver(args.subList(1, args.size()));
    } else if (args.get(0).equals("-remove")) {
      return removeSpanReceiver(args.subList(1, args.size()));
    } else {
      System.err.println("Unrecognized tracing command: " + args.get(0));
      System.err.println("Use -help for help.");
      return 1;
    }
  } finally {
    remote.close();
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:49,代码来源:TraceAdmin.java


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