• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AtomicIncrementRequest类的典型用法和代码示例

java 1次浏览

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

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

示例1: getIncrements

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
public List<AtomicIncrementRequest> getIncrements() {
  List<AtomicIncrementRequest> actions = new ArrayList<AtomicIncrementRequest>();
  if (incrementColumn != null) {
    AtomicIncrementRequest inc = new AtomicIncrementRequest(table,
        incrementRow, cf, incrementColumn);
    actions.add(inc);
  }
  return actions;
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:10,
代码来源:SimpleAsyncHbaseEventSerializer.java

示例2: getIncrements

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
@Override
public List<AtomicIncrementRequest> getIncrements() {
  List<AtomicIncrementRequest> incrs = new ArrayList<AtomicIncrementRequest>();
  AtomicIncrementRequest incr = new AtomicIncrementRequest(table,
      currentEvent.getBody(), cf, column, 1);
  incrs.add(incr);
  return incrs;
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:9,
代码来源:IncrementAsyncHBaseSerializer.java

示例3: process

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
/**
 * Process the received BDGlue event.
 * @param event The BDGlue event we want to process
 * 
 */
public void process(EventData event) {
    List<PutRequest> actions;
    /*
     * Extracts the needed information from the event header
     */
    String rowKeyStr = event.getHeaders().get(ROWKEY_HDR);
    if (rowKeyStr == null) {
       throw new RuntimeException("No row key found in headers!");
    }
    currentRowKey = rowKeyStr.getBytes();
    
    String tableStr = event.getHeaders().get(TABLE_HDR);
    if (tableStr == null) {
       throw new RuntimeException("No table name found in headers!");
    }
    table = tableStr.getBytes();
    
    String cf = event.getHeaders().get(COLUMN_FAMILY_HDR);
    if (cf == null) {
       throw new RuntimeException("No column family found in headers!");
    }
    colFam = cf.getBytes();
    

    actions = setRowValues(event);
    List<AtomicIncrementRequest> increments = getIncrements();
    callbacksExpected.addAndGet(actions.size() + increments.size());

    for (PutRequest action : actions) {
        client.put(action).addCallbacks(putSuccessCallback, putFailureCallback);
    }
    for (AtomicIncrementRequest increment : increments) {
        client.atomicIncrement(increment).
            addCallbacks(incrementSuccessCallback,
                         incrementFailureCallback);
    }

  
}
 

开发者ID:oracle,
项目名称:bdglue,
代码行数:45,
代码来源:AsyncHbaseHelper.java

示例4: getIncrements

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
/**
 * @return the list of increments that should be made in hbase
 * as the result of this event.
 */
public List<AtomicIncrementRequest> getIncrements() {
    incs.clear();
    //Increment the number of events received
    incs.add(new AtomicIncrementRequest(table, 
                                        "totalEvents".getBytes(), 
                                        colFam, eventCountCol));
    return incs;
}
 

开发者ID:oracle,
项目名称:bdglue,
代码行数:13,
代码来源:AsyncHbaseHelper.java

示例5: execute

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
public void execute(final HBaseClient client, String[] args) {
  ensureArguments(args, 6, 7);
  final AtomicIncrementRequest icv =
    new AtomicIncrementRequest(args[2], args[3], args[4], args[5]);
  if (args.length > 6) {
    icv.setAmount(Long.parseLong(args[6]));
  }
  args = null;
  try {
    final long result = client.atomicIncrement(icv).joinUninterruptibly();
    LOG.info("ICV result=" + result);
  } catch (Exception e) {
    LOG.error("ICV failed", e);
  }
}
 

开发者ID:OpenTSDB,
项目名称:asyncbigtable,
代码行数:16,
代码来源:Test.java

示例6: incrementCoalescingWithZeroSumAmount

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
/** Increment coalescing where the coalesced sum ends up being zero. */
@Test
public void incrementCoalescingWithZeroSumAmount() throws Exception {
  client.setFlushInterval(SLOW_FLUSH);
  final byte[] table = TestIntegration.table.getBytes();
  final byte[] key = "cnt".getBytes();
  final byte[] family = TestIntegration.family.getBytes();
  final byte[] qual = { 'q' };
  final DeleteRequest del = new DeleteRequest(table, key, family, qual);
  del.setBufferable(false);
  client.delete(del).join();
  // HBase 0.98 and up do not create a KV on atomic increment when the
  // increment amount is 0.  So let's first send an increment of some
  // arbitrary value, and then ensure that this value hasn't changed.
  long n = client.atomicIncrement(new AtomicIncrementRequest(table, key,
                                                             family, qual,
                                                             42)).join();
  assertEquals(42, n);
  bufferIncrement(table, key, family, qual, 1);
  bufferIncrement(table, key, family, qual, 2);
  bufferIncrement(table, key, family, qual, -3);
  client.flush().joinUninterruptibly();
  final GetRequest get = new GetRequest(table, key)
    .family(family).qualifier(qual);
  final ArrayList<KeyValue> kvs = client.get(get).join();
  assertSizeIs(1, kvs);
  assertEquals(42, Bytes.getLong(kvs.get(0).value()));
  // The sum was 0, but must have sent the increment anyway.
  // So in total we should have sent two increments, the initial one,
  // that sets the value to 42, and the one incrementing by zero.
  assertEquals(2, client.stats().atomicIncrements());
}
 

开发者ID:OpenTSDB,
项目名称:asyncbigtable,
代码行数:33,
代码来源:TestIntegration.java

示例7: bufferIncrement

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
/** Helper method to create an atomic increment request.  */
private Deferred<Long> bufferIncrement(final byte[] table,
                                       final byte[] key, final byte[] family,
                                       final byte[] qual, final long value) {
  return
    client.bufferAtomicIncrement(new AtomicIncrementRequest(table, key,
                                                            family, qual,
                                                            value));
}
 

开发者ID:OpenTSDB,
项目名称:asyncbigtable,
代码行数:10,
代码来源:TestIntegration.java

示例8: getIncrements

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
public List<AtomicIncrementRequest> getIncrements(){
  List<AtomicIncrementRequest> actions = new
      ArrayList<AtomicIncrementRequest>();
  if(incrementColumn != null) {
    AtomicIncrementRequest inc = new AtomicIncrementRequest(table,
        incrementRow, cf, incrementColumn);
    actions.add(inc);
  }
  return actions;
}
 

开发者ID:leoricklin,
项目名称:flume-ng-hbase-sink,
代码行数:11,
代码来源:SimpleAsyncHbaseEventSerializer.java

示例9: getIncrements

点赞 2

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
@Override
public List<AtomicIncrementRequest> getIncrements() {
    incs.clear();
    incs.add(new AtomicIncrementRequest(hTable, "totalEvents".getBytes(), colFamily, eventCountCol));
    return incs;
}
 

开发者ID:dgkris,
项目名称:RSSPipe,
代码行数:7,
代码来源:RSSPipeSerializer.java

示例10: getIncrements

点赞 1

import org.hbase.async.AtomicIncrementRequest; //导入依赖的package包/类
/**
 * Get the increments that should be made in hbase as a result of this
 * event. This list is written to hbase.
 * @return List of {@link org.hbase.async.AtomicIncrementRequest} which
 * are written as such to HBase.
 *
 *
 */
public List<AtomicIncrementRequest> getIncrements();
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:10,
代码来源:AsyncHbaseEventSerializer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)