本文整理汇总了Java中org.apache.hadoop.hbase.client.Table.batch方法的典型用法代码示例。如果您正苦于以下问题:Java Table.batch方法的具体用法?Java Table.batch怎么用?Java Table.batch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.client.Table
的用法示例。
在下文中一共展示了Table.batch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doBatch
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
/**
* Wraps a HBase batch call. Gets the Table for this table, calls batch then
* closes the Table
*/
void doBatch(final List<? extends Row> actions, final Object[] results) {
final Table tableInterface = getTable();
try {
tableInterface.batch(actions, results);
} catch (final Exception e) {
closeTable(tableInterface);
throw new HBaseException(e.getMessage(), e);
} finally {
closeTable(tableInterface);
}
}
示例2: batch
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
/**
* Do the changes and handle the pool
* @param tableName table to insert into
* @param allRows list of actions
* @throws IOException
*/
protected void batch(TableName tableName, Collection<List<Row>> allRows) throws IOException {
if (allRows.isEmpty()) {
return;
}
Table table = null;
try {
// See https://en.wikipedia.org/wiki/Double-checked_locking
Connection connection = this.sharedHtableCon;
if (connection == null) {
synchronized (sharedHtableConLock) {
connection = this.sharedHtableCon;
if (connection == null) {
connection = this.sharedHtableCon = ConnectionFactory.createConnection(this.conf);
}
}
}
table = connection.getTable(tableName);
for (List<Row> rows : allRows) {
table.batch(rows);
}
} catch (InterruptedException ix) {
throw (InterruptedIOException)new InterruptedIOException().initCause(ix);
} finally {
if (table != null) {
table.close();
}
}
}
示例3: prePut
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put,
final WALEdit edit, final Durability durability) throws IOException {
Table table = e.getEnvironment().getTable(otherTable, getPool());
Put p = new Put(new byte[] { 'a' });
p.add(family, null, new byte[] { 'a' });
try {
table.batch(Collections.singletonList(put));
} catch (InterruptedException e1) {
throw new IOException(e1);
}
completedWithPool[0] = true;
table.close();
}
示例4: mutateMetaTable
import org.apache.hadoop.hbase.client.Table; //导入方法依赖的package包/类
/**
* Execute the passed <code>mutations</code> against <code>hbase:meta</code> table.
* @param connection connection we're using
* @param mutations Puts and Deletes to execute on hbase:meta
* @throws IOException
*/
public static void mutateMetaTable(final Connection connection,
final List<Mutation> mutations)
throws IOException {
Table t = getMetaHTable(connection);
try {
t.batch(mutations);
} catch (InterruptedException e) {
InterruptedIOException ie = new InterruptedIOException(e.getMessage());
ie.initCause(e);
throw ie;
} finally {
t.close();
}
}