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


Java THBaseService类代码示例

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


THBaseService类属于org.apache.hadoop.hbase.thrift2.generated包,在下文中一共展示了THBaseService类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getTNonBlockingServer

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入依赖的package包/类
private static TServer getTNonBlockingServer(TProtocolFactory protocolFactory, THBaseService.Processor processor,
    TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) throws TTransportException {
  TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
  log.info("starting HBase Nonblocking Thrift server on " + inetSocketAddress.toString());
  TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport);
  serverArgs.processor(processor);
  serverArgs.transportFactory(transportFactory);
  serverArgs.protocolFactory(protocolFactory);
  return new TNonblockingServer(serverArgs);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:ThriftServer.java

示例7: getTHsHaServer

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入依赖的package包/类
private static TServer getTHsHaServer(TProtocolFactory protocolFactory,
    THBaseService.Processor processor, TTransportFactory transportFactory,
    InetSocketAddress inetSocketAddress, ThriftMetrics metrics)
    throws TTransportException {
  TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
  log.info("starting HBase HsHA Thrift server on " + inetSocketAddress.toString());
  THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
  ExecutorService executorService = createExecutor(
      serverArgs.getWorkerThreads(), metrics);
  serverArgs.executorService(executorService);
  serverArgs.processor(processor);
  serverArgs.transportFactory(transportFactory);
  serverArgs.protocolFactory(protocolFactory);
  return new THsHaServer(serverArgs);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:ThriftServer.java

示例8: getTThreadPoolServer

import org.apache.hadoop.hbase.thrift2.generated.THBaseService; //导入依赖的package包/类
private static TServer getTThreadPoolServer(TProtocolFactory protocolFactory, THBaseService.Processor processor,
    TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) throws TTransportException {
  TServerTransport serverTransport = new TServerSocket(inetSocketAddress);
  log.info("starting HBase ThreadPool Thrift server on " + inetSocketAddress.toString());
  TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverTransport);
  serverArgs.processor(processor);
  serverArgs.transportFactory(transportFactory);
  serverArgs.protocolFactory(protocolFactory);
  return new TThreadPoolServer(serverArgs);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:ThriftServer.java

示例9: 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:zwqjsj0404,项目名称:HBase-Research,代码行数:9,代码来源:ThriftHBaseServiceHandler.java

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

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


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