當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。