当前位置: 首页>>代码示例>>Java>>正文


Java Table.batch方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:gchq,项目名称:stroom-stats,代码行数:16,代码来源:HBaseTable.java

示例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();
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:ReplicationSink.java

示例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();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:TestOpenTableInCoprocessor.java

示例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();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:MetaTableAccessor.java


注:本文中的org.apache.hadoop.hbase.client.Table.batch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。