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


Java THBaseService.Iface方法代码示例

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


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

示例1: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  ThriftHBaseServiceHandler hbaseHandler = createHandler();
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(hbaseHandler, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource());
  metricsHelper.assertCounter( "exists_num_ops", 2, metrics.getSource());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:TestThriftHBaseServiceHandler.java

示例2: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(conf, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  logMetrics(metrics);
  verifyMetrics(metrics, "put_num_ops", 1);
  verifyMetrics(metrics, "exists_num_ops", 2);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:TestThriftHBaseServiceHandler.java

示例3: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(conf, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource());
  metricsHelper.assertCounter( "exists_num_ops", 2, metrics.getSource());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:TestThriftHBaseServiceHandler.java

示例4: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  ThriftHBaseServiceHandler hbaseHandler = createHandler();
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(hbaseHandler, metrics);
  byte[] rowName = Bytes.toBytes("testMetrics");
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<>(2);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource());
  metricsHelper.assertCounter("exists_num_ops", 2, metrics.getSource());
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:TestThriftHBaseServiceHandler.java

示例5: testExceptionType

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
private void testExceptionType(THBaseService.Iface handler, ThriftMetrics metrics,
    ByteBuffer tTableName, byte[] rowkey, ErrorThrowingGetObserver.ErrorType errorType) {
  long preGetCounter = metricsHelper.getCounter("get_num_ops", metrics.getSource());
  String exceptionKey = errorType.getMetricName();
  long preExceptionCounter = metricsHelper.checkCounterExists(exceptionKey, metrics.getSource()) ?
      metricsHelper.getCounter(exceptionKey, metrics.getSource()) :
      0;
  TGet tGet = new TGet(wrap(rowkey));
  Map<ByteBuffer, ByteBuffer> attributes = new HashMap<>();
  attributes.put(wrap(Bytes.toBytes(ErrorThrowingGetObserver.SHOULD_ERROR_ATTRIBUTE)),
      wrap(Bytes.toBytes(errorType.name())));
  tGet.setAttributes(attributes);
  try {
    TResult tResult = handler.get(tTableName, tGet);
    fail("Get with error attribute should have thrown an exception");
  } catch (TException e) {
    LOG.info("Received exception: ", e);
    metricsHelper.assertCounter("get_num_ops", preGetCounter + 1, metrics.getSource());
    metricsHelper.assertCounter(exceptionKey, preExceptionCounter + 1, metrics.getSource());
  }

}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestThriftHBaseServiceHandler.java

示例6: newInstance

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
public static THBaseService.Iface newInstance(
    Configuration conf, ThriftMetrics metrics) {
  THBaseService.Iface handler = new ThriftHBaseServiceHandler(conf);
  return (THBaseService.Iface) Proxy.newProxyInstance(
      handler.getClass().getClassLoader(),
      new Class[]{THBaseService.Iface.class},
      new THBaseServiceMetricsProxy(handler, metrics));
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:9,代码来源:ThriftHBaseServiceHandler.java

示例7: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(conf, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = ByteBuffer.wrap(tableAname);

  TGet get = new TGet(ByteBuffer.wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyAname),
                                    ByteBuffer.wrap(qualifierAname),
                                    ByteBuffer.wrap(valueAname)));
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyBname),
                                    ByteBuffer.wrap(qualifierBname),
                                    ByteBuffer.wrap(valueBname)));
  TPut put = new TPut(ByteBuffer.wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  logMetrics(metrics);
  verifyMetrics(metrics, "put_num_ops", 1);
  verifyMetrics(metrics, "exists_num_ops", 2);
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:30,代码来源:TestThriftHBaseServiceHandler.java

示例8: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(conf, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = ByteBuffer.wrap(tableAname);

  TGet get = new TGet(ByteBuffer.wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyAname),
                                    ByteBuffer.wrap(qualifierAname),
                                    ByteBuffer.wrap(valueAname)));
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyBname),
                                    ByteBuffer.wrap(qualifierBname),
                                    ByteBuffer.wrap(valueBname)));
  TPut put = new TPut(ByteBuffer.wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource());
  metricsHelper.assertCounter( "exists_num_ops", 2, metrics.getSource());
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:29,代码来源:TestThriftHBaseServiceHandler.java

示例9: newInstance

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
public static THBaseService.Iface newInstance(
    THBaseService.Iface handler, ThriftMetrics metrics) {
  return (THBaseService.Iface) Proxy.newProxyInstance(handler.getClass().getClassLoader(),
    new Class[] { THBaseService.Iface.class }, new THBaseServiceMetricsProxy(handler, metrics));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:6,代码来源:ThriftHBaseServiceHandler.java

示例10: THBaseServiceMetricsProxy

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
private THBaseServiceMetricsProxy(THBaseService.Iface handler, ThriftMetrics metrics) {
  this.handler = handler;
  this.metrics = metrics;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:5,代码来源:ThriftHBaseServiceHandler.java

示例11: newInstance

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
public static THBaseService.Iface newInstance(Configuration conf, ThriftMetrics metrics) {
  THBaseService.Iface handler = new ThriftHBaseServiceHandler(conf);
  return (THBaseService.Iface) Proxy.newProxyInstance(handler.getClass().getClassLoader(),
    new Class[] { THBaseService.Iface.class }, new THBaseServiceMetricsProxy(handler, metrics));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:6,代码来源:ThriftHBaseServiceHandler.java

示例12: getMetrics

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
private static ThriftMetrics getMetrics(Configuration conf) throws Exception {
  setupMetricsContext();
  return new ThriftMetrics(Integer.parseInt(ThriftServer.DEFAULT_LISTEN_PORT),
      conf, THBaseService.Iface.class);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:6,代码来源:TestThriftHBaseServiceHandler.java

示例13: testMetricsWithException

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
@Test
public void testMetricsWithException() throws Exception {
  byte[] rowkey = Bytes.toBytes("row1");
  byte[] family = Bytes.toBytes("f");
  byte[] col = Bytes.toBytes("c");
  // create a table which will throw exceptions for requests
  TableName tableName = TableName.valueOf(name.getMethodName());
  HTableDescriptor tableDesc = new HTableDescriptor(tableName);
  tableDesc.addCoprocessor(ErrorThrowingGetObserver.class.getName());
  tableDesc.addFamily(new HColumnDescriptor(family));

  Table table = UTIL.createTable(tableDesc, null);
  table.put(new Put(rowkey).addColumn(family, col, Bytes.toBytes("val1")));

  ThriftHBaseServiceHandler hbaseHandler = createHandler();
  ThriftMetrics metrics = getMetrics(UTIL.getConfiguration());
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(hbaseHandler, metrics);
  ByteBuffer tTableName = wrap(tableName.getName());

  // check metrics increment with a successful get
  long preGetCounter = metricsHelper.checkCounterExists("get_num_ops", metrics.getSource()) ?
      metricsHelper.getCounter("get_num_ops", metrics.getSource()) :
      0;
  TGet tGet = new TGet(wrap(rowkey));
  TResult tResult = handler.get(tTableName, tGet);

  List<TColumnValue> expectedColumnValues = Lists.newArrayList(
      new TColumnValue(wrap(family), wrap(col), wrap(Bytes.toBytes("val1")))
  );
  assertArrayEquals(rowkey, tResult.getRow());
  List<TColumnValue> returnedColumnValues = tResult.getColumnValues();
  assertTColumnValuesEqual(expectedColumnValues, returnedColumnValues);

  metricsHelper.assertCounter("get_num_ops", preGetCounter + 1, metrics.getSource());

  // check metrics increment when the get throws each exception type
  for (ErrorThrowingGetObserver.ErrorType type : ErrorThrowingGetObserver.ErrorType.values()) {
    testExceptionType(handler, metrics, tTableName, rowkey, type);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:42,代码来源:TestThriftHBaseServiceHandler.java

示例14: testMetricsPrecision

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
/**
 * See HBASE-17611
 *
 * Latency metrics were capped at ~ 2 seconds due to the use of an int variable to capture the
 * duration.
 */
@Test
public void testMetricsPrecision() throws Exception {
  byte[] rowkey = Bytes.toBytes("row1");
  byte[] family = Bytes.toBytes("f");
  byte[] col = Bytes.toBytes("c");
  // create a table which will throw exceptions for requests
  TableName tableName = TableName.valueOf("testMetricsPrecision");
  HTableDescriptor tableDesc = new HTableDescriptor(tableName);
  tableDesc.addCoprocessor(DelayingRegionObserver.class.getName());
  tableDesc.addFamily(new HColumnDescriptor(family));

  Table table = null;
  try {
    table = UTIL.createTable(tableDesc, null);

    table.put(new Put(rowkey).addColumn(family, col, Bytes.toBytes("val1")));

    ThriftHBaseServiceHandler hbaseHandler = createHandler();
    ThriftMetrics metrics = getMetrics(UTIL.getConfiguration());
    THBaseService.Iface handler =
        ThriftHBaseServiceHandler.newInstance(hbaseHandler, metrics);
    ByteBuffer tTableName = wrap(tableName.getName());

    // check metrics latency with a successful get
    TGet tGet = new TGet(wrap(rowkey));
    TResult tResult = handler.get(tTableName, tGet);

    List<TColumnValue> expectedColumnValues = Lists.newArrayList(
        new TColumnValue(wrap(family), wrap(col), wrap(Bytes.toBytes("val1")))
    );
    assertArrayEquals(rowkey, tResult.getRow());
    List<TColumnValue> returnedColumnValues = tResult.getColumnValues();
    assertTColumnValuesEqual(expectedColumnValues, returnedColumnValues);

    metricsHelper.assertGaugeGt("get_max", 3000L, metrics.getSource());
  } finally {
    if (table != null) {
      try {
        table.close();
      } catch (IOException ignored) {
      }
      UTIL.deleteTable(tableName);
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:52,代码来源:TestThriftHBaseServiceHandler.java

示例15: THBaseServiceMetricsProxy

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入方法依赖的package包/类
private THBaseServiceMetricsProxy(
    THBaseService.Iface handler, ThriftMetrics metrics) {
  this.handler = handler;
  this.metrics = metrics;
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:6,代码来源:ThriftHBaseServiceHandler.java


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