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


Java ProtocolSignatureProto.getMethodsList方法代码示例

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


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

示例1: convertProtocolSignatureProtos

import org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.ProtocolSignatureProto; //导入方法依赖的package包/类
private static Map<Long, ProtocolSignature> 
convertProtocolSignatureProtos(List<ProtocolSignatureProto> protoList) {
  Map<Long, ProtocolSignature> map = new TreeMap<Long, ProtocolSignature>();
  for (ProtocolSignatureProto p : protoList) {
    int [] methods = new int[p.getMethodsList().size()];
    int index=0;
    for (int m : p.getMethodsList()) {
      methods[index++] = m;
    }
    map.put(p.getVersion(), new ProtocolSignature(p.getVersion(), methods));
  }
  return map;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:RpcClientUtil.java

示例2: testProtocolMetaInfoSSTranslatorPB

import org.apache.hadoop.ipc.protobuf.ProtocolInfoProtos.ProtocolSignatureProto; //导入方法依赖的package包/类
/**
 * Verify that ProtocolMetaInfoServerSideTranslatorPB correctly looks up
 * the server registry to extract protocol signatures and versions.
 */
@Test
public void testProtocolMetaInfoSSTranslatorPB() throws Exception {
  TestImpl1 impl = new TestImpl1();
  server = new RPC.Builder(conf).setProtocol(TestProtocol1.class)
      .setInstance(impl).setBindAddress(ADDRESS).setPort(0).setNumHandlers(2)
      .setVerbose(false).build();
  server.addProtocol(RPC.RpcKind.RPC_WRITABLE, TestProtocol0.class, impl);
  server.start();

  ProtocolMetaInfoServerSideTranslatorPB xlator = 
      new ProtocolMetaInfoServerSideTranslatorPB(server);

  GetProtocolSignatureResponseProto resp = xlator.getProtocolSignature(
      null,
      createGetProtocolSigRequestProto(TestProtocol1.class,
          RPC.RpcKind.RPC_PROTOCOL_BUFFER));
  //No signatures should be found
  Assert.assertEquals(0, resp.getProtocolSignatureCount());
  resp = xlator.getProtocolSignature(
      null,
      createGetProtocolSigRequestProto(TestProtocol1.class,
          RPC.RpcKind.RPC_WRITABLE));
  Assert.assertEquals(1, resp.getProtocolSignatureCount());
  ProtocolSignatureProto sig = resp.getProtocolSignatureList().get(0);
  Assert.assertEquals(TestProtocol1.versionID, sig.getVersion());
  boolean found = false;
  int expected = ProtocolSignature.getFingerprint(TestProtocol1.class
      .getMethod("echo", String.class));
  for (int m : sig.getMethodsList()) {
    if (expected == m) {
      found = true;
      break;
    }
  }
  Assert.assertTrue(found);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:41,代码来源:TestRPCCompatibility.java


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