示例#1
0
 @Override
 protected boolean claimFifoEntry(byte[] row, byte[] value, byte[] oldValue) throws IOException {
   Put put = new Put(keyDistributor.getDistributedKey(row));
   put.add(QueueEntryRow.COLUMN_FAMILY, stateColumnName, value);
   return hTable.checkAndPut(
       put.getRow(), QueueEntryRow.COLUMN_FAMILY, stateColumnName, oldValue, put);
 }
示例#2
0
 @Override
 protected void undoState(Iterable<byte[]> rows, int size) throws IOException {
   List<Delete> deletes = Lists.newArrayListWithCapacity(size);
   for (byte[] row : rows) {
     Delete delete = new Delete(keyDistributor.getDistributedKey(row));
     delete.deleteColumns(QueueEntryRow.COLUMN_FAMILY, stateColumnName);
     deletes.add(delete);
   }
   hTable.delete(deletes);
   hTable.flushCommits();
 }
示例#3
0
  @Override
  protected void updateState(Iterable<byte[]> rows, int size, byte[] value) throws IOException {
    List<Put> puts = Lists.newArrayListWithCapacity(size);

    for (byte[] row : rows) {
      Put put = new Put(keyDistributor.getDistributedKey(row));
      put.add(QueueEntryRow.COLUMN_FAMILY, stateColumnName, value);
      puts.add(put);
    }
    hTable.put(puts);
    hTable.flushCommits();
  }