/** * Closes the stream/underlying cursor(s). The actual close happens asynchronously. */ public void close() { delegate.close(); }
/** * Closes the stream/underlying cursor(s). The actual close happens asynchronously. */ public void close() { delegate.close(); }
/** * Closes the stream/underlying cursor(s). The actual close happens asynchronously. * @param handler called when the stream/underlying cursor(s) is(are) closed */ public void close(Handler<AsyncResult<Void>> handler) { delegate.close(handler); }
/** * Closes the stream/underlying cursor(s). The actual close happens asynchronously. * @param handler called when the stream/underlying cursor(s) is(are) closed */ public void close(Handler<AsyncResult<Void>> handler) { delegate.close(handler); }
@Override public void close(Handler<AsyncResult<Void>> handler) { rowStream.close(h1 -> closeConnection(h2 -> { if (handler != null) { handler.handle(h1); } })); } }
@Test public void testOneShotStream3() { testOneShotStream1(res -> v -> res.close()); }
@Test public void testOneShotStream4() { final AtomicInteger cnt = new AtomicInteger(0); checker().queryStream("SELECT * FROM big_table", onSuccess(res -> { res.resultSetClosedHandler(v -> { fail(new RuntimeException("wrong state")); }).handler(row -> { if(cnt.incrementAndGet() > 100) { res.close(); } }).endHandler(v -> { fail(new RuntimeException()); }).exceptionHandler(t -> { fail(t); }); })); await(); }
@Test public void testStreamAbort() { String sql = "SELECT ID, FNAME, LNAME FROM select_table ORDER BY ID"; connection().queryStream(sql, onSuccess(res -> { res.handler(row -> { res.close(close -> { testComplete(); }); }).endHandler(v -> { fail("Should not be called"); }).exceptionHandler(t -> { fail(t); }); })); await(); }