client.scannerClose(scannerId); client.scannerClose(scannerId);
client.scannerClose(scannerId); client.scannerClose(scannerId);
private void closeScanner(int scannerId) throws IOException { try { synchronized (mutex) { client.scannerClose(scannerId); } } catch (IOError e) { throw new IOException(EXCEPTION_DURING_CLOSING_SCANNER, e); } catch (IllegalArgument e) { throw new IOException(EXCEPTION_DURING_CLOSING_SCANNER, e); } catch (TException e) { throw new IOException(EXCEPTION_DURING_CLOSING_SCANNER, e); } }
@Test(timeout = TestConstants.ITEST_TIMEOUT) public void test() throws Exception { ArrayList<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(); ColumnDescriptor cd = new ColumnDescriptor(); cd.name = FAMILY1; columns.add(cd); cd = new ColumnDescriptor(); cd.name = FAMILY2; columns.add(cd); Hbase.Client client = controller.getThriftClient(); client.createTable(TABLE, columns); ArrayList<Mutation> mutations = new ArrayList<Mutation>(); mutations.add(new Mutation(false, COLUMN, VALUE, true)); client.mutateRow(TABLE, ROW, mutations, null); int scan1 = client.scannerOpen(TABLE, FIRST, Lists.newArrayList(FAMILY1), null); List<TRowResult> rows = client.scannerGet(scan1); assertThat(rows.size(), is(1)); assertThat(Bytes.toString(rows.get(0).getRow()), is("testRow")); assertTrue("No more rows", client.scannerGet(scan1).isEmpty()); client.scannerClose(scan1); int scan2 = client.scannerOpen(TABLE, FIRST, Lists.newArrayList(FAMILY2), null); assertTrue("No more rows", client.scannerGet(scan2).isEmpty()); client.scannerClose(scan2); }
private void getScanner(InetAddress thriftAddress) throws Exception { TTransport transport = new TSocket(thriftAddress.getHostName(), HBaseThriftServerClusterActionHandler.PORT); transport.open(); LOG.info("Connected to thrift server."); LOG.info("Waiting for .META. table..."); TProtocol protocol = new TBinaryProtocol(transport, true, true); Hbase.Client client = new Hbase.Client(protocol); int scannerId = client.scannerOpen(ByteBuffer.wrap(HConstants.META_TABLE_NAME), ByteBuffer.wrap(Bytes.toBytes("")), null, null); client.scannerClose(scannerId); thriftClient = client; }