• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MultiRowMutationService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService的典型用法代码示例。如果您正苦于以下问题:Java MultiRowMutationService类的具体用法?Java MultiRowMutationService怎么用?Java MultiRowMutationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MultiRowMutationService类属于org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos包,在下文中一共展示了MultiRowMutationService类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: multiMutate

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService; //导入依赖的package包/类
/**
 * Performs an atomic multi-Mutate operation against the given table.
 */
private static void multiMutate(HTable table, byte[] row, Mutation... mutations) throws IOException {
  CoprocessorRpcChannel channel = table.coprocessorService(row);
  MutateRowsRequest.Builder mmrBuilder = MutateRowsRequest.newBuilder();
  for (Mutation mutation : mutations) {
    if (mutation instanceof Put) {
      mmrBuilder.addMutationRequest(ProtobufUtil.toMutation(MutationType.PUT, mutation));
    } else if (mutation instanceof Delete) {
      mmrBuilder.addMutationRequest(ProtobufUtil.toMutation(MutationType.DELETE, mutation));
    } else {
      throw new DoNotRetryIOException("multi in MetaEditor doesn't support "
          + mutation.getClass().getName());
    }
  }

  MultiRowMutationService.BlockingInterface service =
      MultiRowMutationService.newBlockingStub(channel);
  try {
    service.mutateRows(null, mmrBuilder.build());
  } catch (ServiceException ex) {
    ProtobufUtil.toIOException(ex);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:26,代码来源:MetaEditor.java


示例2: testMultiRowMutation

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService; //导入依赖的package包/类
@Test
public void testMultiRowMutation() throws Exception {
  LOG.info("Starting testMultiRowMutation");
  final TableName TABLENAME = TableName.valueOf("testMultiRowMutation");
  final byte [] ROW1 = Bytes.toBytes("testRow1");

  Table t = TEST_UTIL.createTable(TABLENAME, FAMILY);
  Put p = new Put(ROW);
  p.add(FAMILY, QUALIFIER, VALUE);
  MutationProto m1 = ProtobufUtil.toMutation(MutationType.PUT, p);

  p = new Put(ROW1);
  p.add(FAMILY, QUALIFIER, VALUE);
  MutationProto m2 = ProtobufUtil.toMutation(MutationType.PUT, p);

  MutateRowsRequest.Builder mrmBuilder = MutateRowsRequest.newBuilder();
  mrmBuilder.addMutationRequest(m1);
  mrmBuilder.addMutationRequest(m2);
  MutateRowsRequest mrm = mrmBuilder.build();
  CoprocessorRpcChannel channel = t.coprocessorService(ROW);
  MultiRowMutationService.BlockingInterface service =
     MultiRowMutationService.newBlockingStub(channel);
  service.mutateRows(null, mrm);
  Get g = new Get(ROW);
  Result r = t.get(g);
  assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIER)));
  g = new Get(ROW1);
  r = t.get(g);
  assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIER)));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestFromClientSide.java


示例3: testMultiRowMutation

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService; //导入依赖的package包/类
@Test
public void testMultiRowMutation() throws Exception {
  LOG.info("Starting testMultiRowMutation");
  final byte [] TABLENAME = Bytes.toBytes("testMultiRowMutation");
  final byte [] ROW1 = Bytes.toBytes("testRow1");

  HTable t = TEST_UTIL.createTable(TABLENAME, FAMILY);
  Put p = new Put(ROW);
  p.add(FAMILY, QUALIFIER, VALUE);
  MutationProto m1 = ProtobufUtil.toMutation(MutationType.PUT, p);

  p = new Put(ROW1);
  p.add(FAMILY, QUALIFIER, VALUE);
  MutationProto m2 = ProtobufUtil.toMutation(MutationType.PUT, p);

  MutateRowsRequest.Builder mrmBuilder = MutateRowsRequest.newBuilder();
  mrmBuilder.addMutationRequest(m1);
  mrmBuilder.addMutationRequest(m2);
  MutateRowsRequest mrm = mrmBuilder.build();
  CoprocessorRpcChannel channel = t.coprocessorService(ROW);
  MultiRowMutationService.BlockingInterface service =
     MultiRowMutationService.newBlockingStub(channel);
  service.mutateRows(null, mrm);
  Get g = new Get(ROW);
  Result r = t.get(g);
  assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIER)));
  g = new Get(ROW1);
  r = t.get(g);
  assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIER)));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:31,代码来源:TestFromClientSide.java


示例4: testMultiRowMutation

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService; //导入依赖的package包/类
@Test
public void testMultiRowMutation() throws Exception {
  LOG.info("Starting testMultiRowMutation");
  final TableName tableName = TableName.valueOf(name.getMethodName());
  final byte [] ROW1 = Bytes.toBytes("testRow1");

  Table t = TEST_UTIL.createTable(tableName, FAMILY);
  Put p = new Put(ROW);
  p.addColumn(FAMILY, QUALIFIER, VALUE);
  MutationProto m1 = ProtobufUtil.toMutation(MutationType.PUT, p);

  p = new Put(ROW1);
  p.addColumn(FAMILY, QUALIFIER, VALUE);
  MutationProto m2 = ProtobufUtil.toMutation(MutationType.PUT, p);

  MutateRowsRequest.Builder mrmBuilder = MutateRowsRequest.newBuilder();
  mrmBuilder.addMutationRequest(m1);
  mrmBuilder.addMutationRequest(m2);
  MutateRowsRequest mrm = mrmBuilder.build();
  CoprocessorRpcChannel channel = t.coprocessorService(ROW);
  MultiRowMutationService.BlockingInterface service =
     MultiRowMutationService.newBlockingStub(channel);
  service.mutateRows(null, mrm);
  Get g = new Get(ROW);
  Result r = t.get(g);
  assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIER)));
  g = new Get(ROW1);
  r = t.get(g);
  assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIER)));
}
 
开发者ID:apache,项目名称:hbase,代码行数:31,代码来源:TestFromClientSide.java


示例5: testRegionObserverEndpoint

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService; //导入依赖的package包/类
@Test
public void testRegionObserverEndpoint() throws IOException, ServiceException {
  final TableName tableName = TableName.valueOf(name.getMethodName());
  try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
       Admin admin = connection.getAdmin()) {
    admin.createTable(
        new HTableDescriptor(tableName)
            .addFamily(new HColumnDescriptor(foo))
            // add the coprocessor for the region
            .addCoprocessor(CustomRegionEndpoint.class.getName()));

    try (Table table = connection.getTable(tableName)) {
      List<Mutation> mutations = Lists.newArrayList(new Put(foo), new Put(bar));
      MutateRowsRequest.Builder mrmBuilder = MutateRowsRequest.newBuilder();

      for (Mutation mutation : mutations) {
        mrmBuilder.addMutationRequest(ProtobufUtil.toMutation(
            ClientProtos.MutationProto.MutationType.PUT, mutation));
      }

      CoprocessorRpcChannel channel = table.coprocessorService(bar);
      MultiRowMutationService.BlockingInterface service =
          MultiRowMutationService.newBlockingStub(channel);
      MutateRowsRequest mrm = mrmBuilder.build();
      service.mutateRows(null, mrm);
    }
  }

  // Find out the MetricRegistry used by the CP using the global registries
  MetricRegistryInfo info = MetricsCoprocessor.createRegistryInfoForRegionCoprocessor(
      CustomRegionEndpoint.class.getName());

  Optional<MetricRegistry> registry =  MetricRegistries.global().get(info);
  assertTrue(registry.isPresent());

  Optional<Metric> metric = registry.get().get("EndpointExecution");
  assertTrue(metric.isPresent());

  Timer endpointExecutions = (Timer)metric.get();
  assertEquals(1, endpointExecutions.getHistogram().getCount());
}
 
开发者ID:apache,项目名称:hbase,代码行数:42,代码来源:TestCoprocessorMetrics.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ILinkingDiagnosticMessageProvider类代码示例发布时间:2022-05-23
下一篇:
Java Margins类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap