use of com.alibaba.jstorm.metric.KVSerializable in project jstorm by alibaba.
the class AbstractHBaseClient method getRow.
protected KVSerializable getRow(String tableName, Class clazz, byte[] key) {
HTableInterface table = getHTableInterface(tableName);
Get get = new Get(key);
HTableInterface htable;
try {
htable = getHTableInterface(tableName);
KVSerializable kvInst = (KVSerializable) clazz.getConstructors()[0].newInstance();
Result result = htable.get(get);
if (result != null) {
kvInst.fromKV(key, result.getValue(CF, V_DATA));
return kvInst;
}
} catch (Exception ex) {
logger.error("Scan metric meta error, class:{}", clazz.getSimpleName(), ex);
} finally {
closeTable(table);
}
return null;
}
Aggregations