Java Code Examples for org.apache.hadoop.hbase.client.Put.setFamilyCellMap()

The following are Jave code examples for showing how to use setFamilyCellMap() of the org.apache.hadoop.hbase.client.Put class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File: HRegion.java   Source Code and License Vote up 5 votes
/**
 * Add updates first to the wal and then add values to memstore. Warning: Assumption is caller has
 * lock on passed in row.
 *
 * @param edits Cell updates by column
 * @throws IOException
 */
private void put(final byte[] row, byte[] family, List<Cell> edits) throws IOException {
  NavigableMap<byte[], List<Cell>> familyMap;
  familyMap = new TreeMap<byte[], List<Cell>>(Bytes.BYTES_COMPARATOR);

  familyMap.put(family, edits);
  Put p = new Put(row);
  p.setFamilyCellMap(familyMap);
  doBatchMutate(p);
}
 
Example 2
Project: ditb   File: RemoteHTable.java   Source Code and License Vote up 5 votes
@Override
public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
    byte[] value, Delete delete) throws IOException {
  Put put = new Put(row);
  put.setFamilyCellMap(delete.getFamilyCellMap());
  // column to check-the-value
  put.add(new KeyValue(row, family, qualifier, value));
  CellSetModel model = buildModelFromPut(put);
  StringBuilder sb = new StringBuilder();
  sb.append('/');
  sb.append(Bytes.toStringBinary(name));
  sb.append('/');
  sb.append(Bytes.toStringBinary(row));
  sb.append("?check=delete");

  for (int i = 0; i < maxRetries; i++) {
    Response response = client.put(sb.toString(),
      Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
    int code = response.getCode();
    switch (code) {
    case 200:
      return true;
    case 304: // NOT-MODIFIED
      return false;
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (final InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("checkAndDelete request failed with " + code);
    }
  }
  throw new IOException("checkAndDelete request timed out");
}