Source:
private KijiFuture<Object> deleteMapFamily( final EntityId entityId, final FamilyLayout familyLayout, final long upToTimestamp ) throws IOException { final String familyName = familyLayout.getName(); final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator() .toHBaseColumnName(KijiColumnName.create(familyName)); final byte[] hbaseRow = entityId.getHBaseRowKey(); List<Deferred<Object>> workers = Lists.newArrayList(); final RowLock rowLock; try { rowLock = mHBClient.lockRow(new RowLockRequest(mTableName, hbaseRow)).join(); final Scanner scanner = mHBClient.newScanner(mTableName); scanner.setFilter(new ColumnPrefixFilter(hbaseColumnName.getQualifier())); scanner.setStartKey(hbaseRow); scanner.setStopKey(hbaseRow); final ArrayList<KeyValue> results; results = scanner.nextRows(1).join().get(0); scanner.close().join(); if (results.isEmpty()) { LOG.debug("No qualifiers to delete in map family: " + familyName); } else { for (KeyValue keyValue : results) { final DeleteRequest delete = new DeleteRequest( mTableName, hbaseRow, keyValue.family(), keyValue.qualifier(), upToTimestamp); LOG.debug("Deleting HBase column {}", hbaseColumnName); workers.add(mHBClient.delete(delete)); } } } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); throw new InternalKijiError(e); } try { workers.add(mHBClient.unlockRow(rowLock)); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } Deferred<Object> groupedDeferred = Deferred.group(workers) .addCallback(new Callback<Object, ArrayList<Object>>() { @Override public Object call(final ArrayList<Object> objects) throws Exception { if (objects != null && !objects.isEmpty()) { return objects.get(objects.size()-1); } else { return new Object(); } } }); return AsyncHBaseKijiFuture.create(groupedDeferred); }

Target:
private KijiFuture<Object> deleteMapFamily( final EntityId entityId, final FamilyLayout familyLayout, final long upToTimestamp ) throws IOException { final WriterLayoutCapsule writerLayoutCapsule = mWriterLayoutCapsule; final String familyName = familyLayout.getName(); final HBaseColumnName hbaseColumnName = writerLayoutCapsule.getColumnNameTranslator() .toHBaseColumnName(KijiColumnName.create(familyName)); final byte[] hbaseRow = entityId.getHBaseRowKey(); List<Deferred<Object>> workers = Lists.newArrayList(); final RowLock rowLock; Deferred<Object> deferred = null; try { rowLock = mHBClient.lockRow(new RowLockRequest(mTableName, hbaseRow)).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); throw new InternalKijiError(e); } try { final Scanner scanner = mHBClient.newScanner(mTableName); scanner.setFilter(new ColumnPrefixFilter(hbaseColumnName.getQualifier())); scanner.setMaxVersions(1); scanner.setStartKey(hbaseRow); scanner.setStopKey(hbaseRow); final ArrayList<KeyValue> results; results = scanner.nextRows(1).join().get(0); scanner.close().join(); if (results.isEmpty()) { LOG.debug("No qualifiers to delete in map family: " + familyName); } else { int i = 0; final byte[][] qualifiers = new byte[results.size()][]; for (KeyValue keyValue : results) { qualifiers[i] = keyValue.qualifier(); i++; LOG.debug("Deleting HBase column {}", hbaseColumnName); } DeleteRequest delete = new DeleteRequest( mTableName, hbaseRow, hbaseColumnName.getFamily(), qualifiers, upToTimestamp); deferred = mHBClient.delete(delete); } } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } finally { try { mHBClient.unlockRow(rowLock).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } } return AsyncHBaseKijiFuture.create(deferred); }