本文整理汇总了Java中org.apache.hadoop.hbase.thrift.ThriftServerRunner.HBaseHandler.incrementRows方法的典型用法代码示例。如果您正苦于以下问题:Java HBaseHandler.incrementRows方法的具体用法?Java HBaseHandler.incrementRows怎么用?Java HBaseHandler.incrementRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.thrift.ThriftServerRunner.HBaseHandler
的用法示例。
在下文中一共展示了HBaseHandler.incrementRows方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTestIncrements
import org.apache.hadoop.hbase.thrift.ThriftServerRunner.HBaseHandler; //导入方法依赖的package包/类
public static void doTestIncrements(HBaseHandler handler) throws Exception {
List<Mutation> mutations = new ArrayList<Mutation>(1);
mutations.add(new Mutation(false, columnAAname, valueEname, true));
mutations.add(new Mutation(false, columnAname, valueEname, true));
handler.mutateRow(tableAname, rowAname, mutations, null);
handler.mutateRow(tableAname, rowBname, mutations, null);
List<TIncrement> increments = new ArrayList<TIncrement>();
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
int numIncrements = 60000;
for (int i = 0; i < numIncrements; i++) {
handler.increment(new TIncrement(tableAname, rowAname, columnAname, 2));
handler.incrementRows(increments);
}
Thread.sleep(1000);
long lv = handler.get(tableAname, rowAname, columnAname, null).get(0).value.getLong();
// Wait on all increments being flushed
while (handler.coalescer.getQueueSize() != 0) Threads.sleep(10);
assertEquals((100 + (2 * numIncrements)), lv );
lv = handler.get(tableAname, rowBname, columnAAname, null).get(0).value.getLong();
assertEquals((100 + (3 * 7 * numIncrements)), lv);
assertTrue(handler.coalescer.getSuccessfulCoalescings() > 0);
}
示例2: doTestIncrements
import org.apache.hadoop.hbase.thrift.ThriftServerRunner.HBaseHandler; //导入方法依赖的package包/类
public static void doTestIncrements(HBaseHandler handler) throws Exception {
List<Mutation> mutations = new ArrayList<Mutation>(1);
mutations.add(new Mutation(false, columnAAname, valueEname, true));
mutations.add(new Mutation(false, columnAname, valueEname, true));
handler.mutateRow(tableAname, rowAname, mutations, null);
handler.mutateRow(tableAname, rowBname, mutations, null);
List<TIncrement> increments = new ArrayList<TIncrement>();
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
int numIncrements = 60000;
for (int i = 0; i < numIncrements; i++) {
handler.increment(new TIncrement(tableAname, rowAname, columnAname, 2));
handler.incrementRows(increments);
}
Thread.sleep(1000);
long lv = handler.get(tableAname, rowAname, columnAname, null).get(0).value.getLong();
assertEquals((100 + (2 * numIncrements)), lv );
lv = handler.get(tableAname, rowBname, columnAAname, null).get(0).value.getLong();
assertEquals((100 + (3 * 7 * numIncrements)), lv);
assertTrue(handler.coalescer.getSuccessfulCoalescings() > 0);
}
示例3: doTestIncrements
import org.apache.hadoop.hbase.thrift.ThriftServerRunner.HBaseHandler; //导入方法依赖的package包/类
public static void doTestIncrements(HBaseHandler handler) throws Exception {
List<Mutation> mutations = new ArrayList<>(1);
mutations.add(new Mutation(false, columnAAname, valueEname, true));
mutations.add(new Mutation(false, columnAname, valueEname, true));
handler.mutateRow(tableAname, rowAname, mutations, null);
handler.mutateRow(tableAname, rowBname, mutations, null);
List<TIncrement> increments = new ArrayList<>(3);
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
int numIncrements = 60000;
for (int i = 0; i < numIncrements; i++) {
handler.increment(new TIncrement(tableAname, rowAname, columnAname, 2));
handler.incrementRows(increments);
}
Thread.sleep(1000);
long lv = handler.get(tableAname, rowAname, columnAname, null).get(0).value.getLong();
// Wait on all increments being flushed
while (handler.coalescer.getQueueSize() != 0) {
Threads.sleep(10);
}
assertEquals((100 + (2 * numIncrements)), lv);
lv = handler.get(tableAname, rowBname, columnAAname, null).get(0).value.getLong();
assertEquals((100 + (3 * 7 * numIncrements)), lv);
assertTrue(handler.coalescer.getSuccessfulCoalescings() > 0);
}