本文整理匯總了Java中org.apache.hadoop.hbase.client.HConnection.getTable方法的典型用法代碼示例。如果您正苦於以下問題:Java HConnection.getTable方法的具體用法?Java HConnection.getTable怎麽用?Java HConnection.getTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.client.HConnection
的用法示例。
在下文中一共展示了HConnection.getTable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initializeAdapter
import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
@Override
public boolean initializeAdapter(Map<String, Object> config) {
// Initialize HBase Table
Configuration conf = null;
conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", _quorum);
conf.set("hbase.zookeeper.property.clientPort", _port);
try {
LOGGER.debug("=======Connecting to HBASE===========");
LOGGER.debug("=======ZOOKEEPER = {}", conf.get("hbase.zookeeper.quorum"));
HConnection connection = HConnectionManager.createConnection(conf);
table = connection.getTable(_tableName);
return true;
} catch (IOException e) {
LOGGER.debug("=======Unable to Connect to HBASE===========");
e.printStackTrace();
}
return false;
}
示例2: populateUserProfile
import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
public static void populateUserProfile(HConnection connection, UserProfile userProfile) throws Exception {
HTableInterface table = connection.getTable(HBaseTableMetaModel.profileCacheTableName);
try {
Put put = new Put(convertKeyToRowKey(HBaseTableMetaModel.profileCacheTableName, userProfile.userId));
put.add(HBaseTableMetaModel.profileCacheColumnFamily, HBaseTableMetaModel.profileCacheJsonColumn, Bytes.toBytes(userProfile.getJSONObject().toString()));
put.add(HBaseTableMetaModel.profileCacheColumnFamily, HBaseTableMetaModel.profileCacheTsColumn, Bytes.toBytes(System.currentTimeMillis()));
table.put(put);
} finally {
table.close();
}
}
示例3: populateValidationRules
import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
public static void populateValidationRules(HConnection connection, ValidationRules rules) throws Exception {
HTableInterface table = connection.getTable(HBaseTableMetaModel.profileCacheTableName);
try {
Put put = new Put(HBaseTableMetaModel.validationRulesRowKey);
put.add(HBaseTableMetaModel.profileCacheColumnFamily, HBaseTableMetaModel.validationRulesRowKey, Bytes.toBytes(rules.getJSONObject().toString()));
table.put(put);
} finally {
table.close();
}
}
示例4: connectToHashTables
import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
public static HTableInterface[] connectToHashTables(HConnection conn, int num, String prefix)
throws IOException {
HTableInterface[] hashTables = new HTable[num];
for (int i = 0; i < num; ++i) {
hashTables[i] = conn.getTable(prefix + String.valueOf(i));
}
return hashTables;
}