當前位置: 首頁>>代碼示例>>Java>>正文


Java Table.checkAndPut方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.Table.checkAndPut方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.checkAndPut方法的具體用法?Java Table.checkAndPut怎麽用?Java Table.checkAndPut使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.Table的用法示例。


在下文中一共展示了Table.checkAndPut方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doCheckAndPut

import org.apache.hadoop.hbase.client.Table; //導入方法依賴的package包/類
public static boolean doCheckAndPut(final Table tableInterface, final byte[] row, final byte[] family,
        final byte[] qualifier, final byte[] value, final Put put) {
    boolean result;
    try {
        result = tableInterface.checkAndPut(row, family, qualifier, value, put);
    } catch (final Exception e) {
        closeTable(tableInterface);
        throw new HBaseException(e.getMessage(), e);
    }
    return result;
}
 
開發者ID:gchq,項目名稱:stroom-stats,代碼行數:12,代碼來源:HBaseTable.java

示例2: checkAndPut

import org.apache.hadoop.hbase.client.Table; //導入方法依賴的package包/類
@Override
public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family,
    ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException {
  Table htable = getTable(table);
  try {
    return htable.checkAndPut(byteBufferToByteArray(row), byteBufferToByteArray(family),
      byteBufferToByteArray(qualifier), (value == null) ? null : byteBufferToByteArray(value),
      putFromThrift(put));
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:ThriftHBaseServiceHandler.java

示例3: mutate

import org.apache.hadoop.hbase.client.Table; //導入方法依賴的package包/類
public void mutate(Table table, Mutation m,
    long keyBase, byte[] row, byte[] cf, byte[] q, byte[] v) {
  long start = System.currentTimeMillis();
  try {
    m = dataGenerator.beforeMutate(keyBase, m);
    if (m instanceof Increment) {
      table.increment((Increment)m);
    } else if (m instanceof Append) {
      table.append((Append)m);
    } else if (m instanceof Put) {
      table.checkAndPut(row, cf, q, v, (Put)m);
    } else if (m instanceof Delete) {
      table.checkAndDelete(row, cf, q, v, (Delete)m);
    } else {
      throw new IllegalArgumentException(
        "unsupported mutation " + m.getClass().getSimpleName());
    }
    totalOpTimeMs.addAndGet(System.currentTimeMillis() - start);
  } catch (IOException e) {
    if (ignoreNonceConflicts && (e instanceof OperationConflictException)) {
      LOG.info("Detected nonce conflict, ignoring: " + e.getMessage());
      totalOpTimeMs.addAndGet(System.currentTimeMillis() - start);
      return;
    }
    failedKeySet.add(keyBase);
    String exceptionInfo;
    if (e instanceof RetriesExhaustedWithDetailsException) {
      RetriesExhaustedWithDetailsException aggEx = (RetriesExhaustedWithDetailsException) e;
      exceptionInfo = aggEx.getExhaustiveDescription();
    } else {
      exceptionInfo = StringUtils.stringifyException(e);
    }
    LOG.error("Failed to mutate: " + keyBase + " after " +
        (System.currentTimeMillis() - start) +
      "ms; region information: " + getRegionDebugInfoSafe(table, m.getRow()) + "; errors: "
        + exceptionInfo);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:39,代碼來源:MultiThreadedUpdater.java


注:本文中的org.apache.hadoop.hbase.client.Table.checkAndPut方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。