@Override public synchronized void responseCompleted(HttpContext context) { this.completed = true; try { if (sharedStream != null) { // only needed in case of empty response body (=null ioctrl) sharedStream.consumeContent(EndOfStream.INSTANCE, null); } } catch (IOException ioe) { // cannot happen throw new RuntimeException(ioe); } finally { releaseResources(); } }
completed = true; if (future != null) future.failed(exception); releaseResources();
completed = true; if (future != null) future.failed(exception); releaseResources();
StreamingResponseConsumer<T> responseConsumer = new StreamingResponseConsumer<T>(request, extractor); return responseConsumer.future(httpFuture);
StreamingResponseConsumer<T> responseConsumer = new StreamingResponseConsumer<T>(request, extractor); return responseConsumer.future(httpFuture);
@Override public synchronized void responseCompleted(HttpContext context) { this.completed = true; try { if (sharedStream != null) { // only needed in case of empty response body (=null ioctrl) sharedStream.consumeContent(EndOfStream.INSTANCE, null); } } catch (IOException ioe) { // cannot happen throw new RuntimeException(ioe); } finally { releaseResources(); } }
@Override public synchronized void responseCompleted(HttpContext context) { this.completed = true; try { if (sharedStream != null) { // only needed in case of empty response body (=null ioctrl) sharedStream.consumeContent(EndOfStream.INSTANCE, null); } } catch (IOException ioe) { // cannot happen throw new RuntimeException(ioe); } finally { releaseResources(); } }
@Override public synchronized void close() { completed = true; ResultFuture<T> future = this.future; if (future != null) { // if connect fails, then the httpclient just calls close() after setting its future, but never our failed(). // so copy the httpFuture-result into our ResultFuture. future.copyHttpFutureResult(); if (!future.isDone()) { // doesnt happen? future.failed(clientException(new IOException("connect failed"), null)); } } releaseResources(); }
@Override public synchronized void close() { completed = true; ResultFuture<T> future = this.future; if (future != null) { // if connect fails, then the httpclient just calls close() after setting its future, but never our failed(). // so copy the httpFuture-result into our ResultFuture. future.copyHttpFutureResult(); if (!future.isDone()) { // doesnt happen? future.failed(clientException(new IOException("connect failed"), null)); } } releaseResources(); }
public synchronized Future<T> future(Future<T> httpFuture) { if (completed) { // already failed or fully buffered return httpFuture; } future = new ResultFuture<T>(httpFuture); future.copyHttpFutureResult(); if (!future.isDone() && hasResult) { // response(-headers) is available, but not yet the full response-stream. Return immediately the result future.completed(getResult()); } return future; }
@Override public synchronized boolean cancel() { completed = true; if (future != null) future.cancelledResult(); if (sharedStream != null) { sharedStream.setException(new IOException("cancelled")); IOUtils.closeQuietly(sharedStream); } releaseResources(); return true; }
public synchronized Future<T> future(Future<T> httpFuture) { if (completed) { // already failed or fully buffered return httpFuture; } future = new ResultFuture<T>(httpFuture); future.copyHttpFutureResult(); if (!future.isDone() && hasResult) { // response(-headers) is available, but not yet the full response-stream. Return immediately the result future.completed(getResult()); } return future; }
@Override public synchronized boolean cancel() { completed = true; if (future != null) future.cancelledResult(); if (sharedStream != null) { sharedStream.setException(new IOException("cancelled")); IOUtils.closeQuietly(sharedStream); } releaseResources(); return true; }
@Override public synchronized void failed(Exception ex) { completed = true; if (future != null) future.failed(clientException(ex, null)); if (sharedStream != null) { sharedStream.setException(ioException(ex)); IOUtils.closeQuietly(sharedStream); } releaseResources(); }
@Override public synchronized void failed(Exception ex) { completed = true; if (future != null) future.failed(clientException(ex, null)); if (sharedStream != null) { sharedStream.setException(ioException(ex)); IOUtils.closeQuietly(sharedStream); } releaseResources(); }
completed = true; if (future != null) future.failed(exception); releaseResources();
StreamingResponseConsumer<T> responseConsumer = new StreamingResponseConsumer<T>(request, extractor); return responseConsumer.future(httpFuture);
@Override public synchronized void close() { completed = true; ResultFuture<T> future = this.future; if (future != null) { // if connect fails, then the httpclient just calls close() after setting its future, but never our failed(). // so copy the httpFuture-result into our ResultFuture. future.copyHttpFutureResult(); if (!future.isDone()) { // doesnt happen? future.failed(clientException(new IOException("connect failed"), null)); } } releaseResources(); }
public synchronized Future<T> future(Future<T> httpFuture) { if (completed) { // already failed or fully buffered return httpFuture; } future = new ResultFuture<T>(httpFuture); future.copyHttpFutureResult(); if (!future.isDone() && hasResult) { // response(-headers) is available, but not yet the full response-stream. Return immediately the result future.completed(getResult()); } return future; }
@Override public synchronized boolean cancel() { completed = true; if (future != null) future.cancelledResult(); if (sharedStream != null) { sharedStream.setException(new IOException("cancelled")); IOUtils.closeQuietly(sharedStream); } releaseResources(); return true; }