try { int numResults = 0; while ((rows = scanner.nextRows().join(joinTimeout)) != null) { for (final ArrayList<KeyValue> row : rows) { final HashMap<String, ByteIterator> rowResult =
/** * Scans the next batch of rows * * @return next batch of rows that were scanned. * * @see org.hbase.async.Scanner#nextRows() */ public Deferred<ArrayList<ArrayList<KeyValue>>> nextRows() { return scanner.nextRows(); }
/** * Scans the next batch of rows * * @param rows maximum number of rows to retrieve in the batch. * * @return next batch of rows that were scanned. * * @see org.hbase.async.Scanner#nextRows(int) */ public Deferred<ArrayList<ArrayList<KeyValue>>> nextRows(final int rows) { return scanner.nextRows(rows); } }
/** * Scans a number of rows. Calling this method is equivalent to: * <pre> * this.{@link #setMaxNumRows setMaxNumRows}(nrows); * this.{@link #nextRows() nextRows}(); * </pre> * @param nrows The maximum number of rows to retrieve. * @return A deferred list of rows. * @see #setMaxNumRows * @see #nextRows() */ public Deferred<ArrayList<ArrayList<KeyValue>>> nextRows(final int nrows) { setMaxNumRows(nrows); return nextRows(); }
public Deferred<ArrayList<ArrayList<KeyValue>>> call(final Object arg) { final Response resp; if (arg instanceof Long) { scanner_id = (Long) arg; resp = null; } else if (arg instanceof Response) { resp = (Response) arg; scanner_id = resp.scanner_id; scannerClosedOnServer = resp.scannerClosedOnServer; moreRows = resp.more; } else { throw new IllegalStateException("WTF? Scanner open callback" + " invoked with impossible" + " argument: " + arg); } if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + Bytes.hex(scanner_id) + " opened on " + region); } if (resp != null) { if (resp.rows == null) { return scanFinished(!resp.more); } return Deferred.fromResult(resp.rows); } return nextRows(); // Restart the call. } public String toString() {
final Scanner scanner = Internal.getScanner(query); ArrayList<ArrayList<KeyValue>> rows; while ((rows = scanner.nextRows().joinUninterruptibly()) != null) { for (final ArrayList<KeyValue> row : rows) { buf.setLength(0);
ArrayList<ArrayList<KeyValue>> rows; while ((short) suggestions.size() < MAX_SUGGESTIONS && (rows = scanner.nextRows().joinUninterruptibly()) != null) { for (final ArrayList<KeyValue> row : rows) { if (row.size() != 1) {
try { ArrayList<ArrayList<KeyValue>> rows; while ((rows = scanner.nextRows().joinUninterruptibly()) != null) { hbase_time += (System.nanoTime() - starttime) / 1000000; for (final ArrayList<KeyValue> row : rows) {
private ArrayList<ArrayList<KeyValue>> _getSingleRow(final String start, final String end, final FilterList filterList, final String tableName) { final Scanner scanner = _client.newScanner(tableName); scanner.setStartKey(start); scanner.setStopKey(end); scanner.setMaxNumRows(1); scanner.setFilter(filterList); _logger.debug("Using table: " + tableName); _logger.debug("Scan startRow: " + start); _logger.debug("Scan stopRow: " + end); Deferred<ArrayList<ArrayList<KeyValue>>> deferred = scanner.nextRows(); deferred.addCallback(new Callback<ArrayList<ArrayList<KeyValue>>, ArrayList<ArrayList<KeyValue>>>() { @Override public ArrayList<ArrayList<KeyValue>> call(ArrayList<ArrayList<KeyValue>> rows) throws Exception { scanner.close(); return rows; } }); try { ArrayList<ArrayList<KeyValue>> result = deferred.join(SCAN_TIMEOUT_MS); return result; } catch (InterruptedException e) { throw new SystemException("Interrupted while waiting to obtain results for query", e); } catch (TimeoutException e) { _logger.warn("Timed out while waiting to obtain results."); } catch (Exception e) { throw new SystemException("Exception occurred in getting results for query", e); } return null; }
private ArrayList<ArrayList<KeyValue>> _getSingleRow(final String start, final String end, final FilterList filterList, final String tableName) { final Scanner scanner = _client.newScanner(tableName); scanner.setStartKey(start); scanner.setStopKey(end); scanner.setMaxNumRows(1); scanner.setFilter(filterList); _logger.debug("Using table: " + tableName); _logger.debug("Scan startRow: " + start); _logger.debug("Scan stopRow: " + end); Deferred<ArrayList<ArrayList<KeyValue>>> deferred = scanner.nextRows(); deferred.addCallback(new Callback<ArrayList<ArrayList<KeyValue>>, ArrayList<ArrayList<KeyValue>>>() { @Override public ArrayList<ArrayList<KeyValue>> call(ArrayList<ArrayList<KeyValue>> rows) throws Exception { scanner.close(); return rows; } }); try { ArrayList<ArrayList<KeyValue>> result = deferred.join(SCAN_TIMEOUT_MS); return result; } catch (InterruptedException e) { throw new SystemException("Interrupted while waiting to obtain results for query", e); } catch (TimeoutException e) { _logger.warn("Timed out while waiting to obtain results."); } catch (Exception e) { throw new SystemException("Exception occurred in getting results for query", e); } return null; }
try { ArrayList<ArrayList<KeyValue>> rows; while ((rows = scanner.nextRows().joinUninterruptibly()) != null) { for (final ArrayList<KeyValue> row : rows) { for (final KeyValue kv : row) {
return nextRows();
try { ArrayList<ArrayList<KeyValue>> rows; while ((rows = scanner.nextRows().joinUninterruptibly()) != null) { for (final ArrayList<KeyValue> row : rows) { found |= printResult(row, ID_FAMILY, true);
static List<Deferred<Boolean>> doList(HBaseClient client) throws Throwable { final Scanner scanner = client.newScanner(TABLE_NAME); scanner.setFamily(INFO_FAM); scanner.setQualifier(PASSWORD_COL); ArrayList<ArrayList<KeyValue>> rows = null; ArrayList<Deferred<Boolean>> workers = new ArrayList<Deferred<Boolean>>(); while ((rows = scanner.nextRows(1).joinUninterruptibly()) != null) { LOG.info("received a page of users."); for (ArrayList<KeyValue> row : rows) { KeyValue kv = row.get(0); byte[] expected = kv.value(); String userId = new String(kv.key()); PutRequest put = new PutRequest( TABLE_NAME, kv.key(), kv.family(), kv.qualifier(), mkNewPassword(expected)); Deferred<Boolean> d = client.compareAndSet(put, expected) .addCallback(new InterpretResponse(userId)) .addCallbacks(new ResultToMessage(), new FailureToMessage()) .addCallback(new SendMessage()); workers.add(d); } } return workers; }
final Scanner scanner = Internal.getScanner(query); ArrayList<ArrayList<KeyValue>> rows; while ((rows = scanner.nextRows().joinUninterruptibly()) != null) { for (final ArrayList<KeyValue> row : rows) { rowcount++;
/** * Package-private access point for {@link Scanner}s to scan more rows. * @param scanner The scanner to use. * @return A deferred row. */ Deferred<Object> scanNextRows(final Scanner scanner) { final RegionInfo region = scanner.currentRegion(); final RegionClient client = clientFor(region); if (client == null) { // Oops, we no longer know anything about this client or region. Our // cache was probably invalidated while the client was scanning. This // means that we lost the connection to that RegionServer, so we have to // re-open this scanner if we wanna keep scanning. scanner.invalidate(); // Invalidate the scanner so that ... @SuppressWarnings("unchecked") final Deferred<Object> d = (Deferred) scanner.nextRows(); return d; // ... this will re-open it ______.^ } num_scans.increment(); final HBaseRpc next_request = scanner.getNextRowsRequest(); final Deferred<Object> d = next_request.getDeferred(); client.sendRpc(next_request); return d; }
return meta_scanner.nextRows().addCallback(new MetaScanner());
this.logger.debug("Starting to fetch rows"); while ((rows = this.scanner.nextRows(this.river.getBatchSize()).addErrback(this.cbLogger).joinUninterruptibly()) != null) { if (this.stopThread) { this.logger.info("Stopping HBase import in the midle of it");