本文整理匯總了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);
}
}