private void readNext() { final List<String> scans = new ArrayList<>(); while (tsIter.hasNext()) { final String tserver = tsIter.next(); try { final List<ActiveScan> asl = instanceOps.getActiveScans(tserver); for (ActiveScan as : asl) { scans.add(String.format( "%21s |%21s |%9s |%9s |%7s |%6s |%8s |%8s |%10s |%20s |%10s |%20s |%10s | %s", tserver, as.getClient(), Duration.format(as.getAge(), "", "-"), Duration.format(as.getLastContactTime(), "", "-"), as.getState(), as.getType(), as.getUser(), as.getTable(), as.getColumns(), as.getAuthorizations(), (as.getType() == ScanType.SINGLE ? as.getTablet() : "N/A"), as.getScanid(), as.getSsiList(), as.getSsio())); } } catch (Exception e) { scans.add(tserver + " ERROR " + e.getMessage()); } if (scans.size() > 0) { break; } } scansIter = scans.iterator(); }
@Override public void run() { try { // ensure the scan is running: not perfect, the metadata tables could be scanned, too. String tserver = conn.instanceOperations().getTabletServers().iterator().next(); do { ArrayList<ActiveScan> scans = new ArrayList<>( conn.instanceOperations().getActiveScans(tserver)); Iterator<ActiveScan> iter = scans.iterator(); while (iter.hasNext()) { ActiveScan scan = iter.next(); // Remove scans not against our table and not owned by us if (!getAdminPrincipal().equals(scan.getUser()) || !tableName.equals(scan.getTable())) { iter.remove(); } } if (!scans.isEmpty()) { // We found our scan break; } } while (true); } catch (Exception e) { e.printStackTrace(); } // BAM! scanThread.interrupt(); } };
private void readNext() { final List<String> scans = new ArrayList<>(); while (tsIter.hasNext()) { final String tserver = tsIter.next(); try { final List<ActiveScan> asl = instanceOps.getActiveScans(tserver); for (ActiveScan as : asl) { scans.add(String.format( "%21s |%21s |%9s |%9s |%7s |%6s |%8s |%8s |%10s |%20s |%10s |%20s |%10s | %s", tserver, as.getClient(), Duration.format(as.getAge(), "", "-"), Duration.format(as.getLastContactTime(), "", "-"), as.getState(), as.getType(), as.getUser(), as.getTable(), as.getColumns(), as.getAuthorizations(), (as.getType() == ScanType.SINGLE ? as.getTablet() : "N/A"), as.getScanid(), as.getSsiList(), as.getSsio())); } } catch (Exception e) { scans.add(tserver + " ERROR " + e.getMessage()); } if (scans.size() > 0) { break; } } scansIter = scans.iterator(); }
if (tableName.equals(scan.getTable()) && scan.getSsiList().size() > 0) { assertEquals("Not the expected iterator", 1, scan.getSsiList().size()); assertTrue("Not the expected iterator",
pscan.table = scan.getTable(); pscan.age = scan.getAge(); pscan.idleTime = scan.getIdleTime();