本文整理汇总了Java中org.apache.hadoop.hbase.client.Table.incrementColumnValue方法的典型用法代码示例。如果您正苦于以下问题:Java Table.incrementColumnValue方法的具体用法?Java Table.incrementColumnValue怎么用?Java Table.incrementColumnValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.client.Table
的用法示例。
在下文中一共展示了Table.incrementColumnValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: incrementColumnValue
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
/**
* Does the increment using the tableInterface but leaves it open for
* further use
*/
public long incrementColumnValue(final Table tableInterface, final byte[] row, final byte[] family,
final byte[] qualifier, final long amount) {
long result;
try {
result = tableInterface.incrementColumnValue(row, family, qualifier, amount);
} catch (final Exception e) {
closeTable(tableInterface);
throw new HBaseException(e.getMessage(), e);
}
return result;
}
示例2: createIncCallable
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
private Callable<Integer> createIncCallable() {
return new Callable<Integer>() {
@Override
public Integer call() throws Exception {
int failures = 0;
Set<FullyQualifiedRow> keys = countersMap.keySet();
for (FullyQualifiedRow row : keys) {
Long counter = countersMap.remove(row);
if (counter == null) {
continue;
}
Table table = null;
try {
table = handler.getTable(row.getTable());
if (failures > 2) {
throw new IOException("Auto-Fail rest of ICVs");
}
table.incrementColumnValue(row.getRowKey(), row.getFamily(), row.getQualifier(),
counter);
} catch (IOException e) {
// log failure of increment
failures++;
LOG.error("FAILED_ICV: " + Bytes.toString(row.getTable()) + ", "
+ Bytes.toStringBinary(row.getRowKey()) + ", "
+ Bytes.toStringBinary(row.getFamily()) + ", "
+ Bytes.toStringBinary(row.getQualifier()) + ", " + counter, e);
} finally{
if(table != null){
table.close();
}
}
}
return failures;
}
};
}
示例3: atomicIncrement
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
protected long atomicIncrement(ByteBuffer tableName, ByteBuffer row,
byte [] family, byte [] qualifier, long amount)
throws IOError, IllegalArgument, TException {
Table table = null;
try {
table = getTable(tableName);
return table.incrementColumnValue(
getBytes(row), family, qualifier, amount);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(Throwables.getStackTraceAsString(e));
} finally {
closeTable(table);
}
}