void triggerNewCacheEntryResponse(final HttpResponse backendResponse, final Date responseDate, final ByteArrayBuffer buffer) { final CancellableDependency operation = scope.cancellableDependency; operation.setDependency(responseCache.createCacheEntry( target, request, backendResponse, buffer, requestDate, responseDate, new FutureCallback<HttpCacheEntry>() { @Override public void completed(final HttpCacheEntry newEntry) { log.debug("Backend response successfully cached"); try { final SimpleHttpResponse cacheResponse = responseGenerator.generateResponse(request, newEntry); triggerResponse(cacheResponse, scope, asyncExecCallback); } catch (final ResourceIOException ex) { asyncExecCallback.failed(ex); } } @Override public void failed(final Exception ex) { asyncExecCallback.failed(ex); } @Override public void cancelled() { asyncExecCallback.failed(new InterruptedIOException()); } })); }
@Override public boolean isExecutionAborted() { return cancellableDependency != null && cancellableDependency.isCancelled(); }
state = object; if (cancellableDependency != null) { if (cancellableDependency.isCancelled()) { connRequest.cancel(); throw new RequestFailedException("Request aborted"); cancellableDependency.setDependency(connRequest); reusable = connectionEndpoint.isConnected(); if (cancellableDependency != null) { cancellableDependency.setDependency(this);
void triggerUpdatedCacheEntryResponse(final HttpResponse backendResponse, final Date responseDate) { final CancellableDependency operation = scope.cancellableDependency; recordCacheUpdate(scope.clientContext); operation.setDependency(responseCache.updateCacheEntry( target, request,
if (request instanceof CancellableDependency && ((CancellableDependency) request).isCancelled()) { return false;
void updateVariantCacheEntry(final HttpResponse backendResponse, final Date responseDate, final Variant matchingVariant) { recordCacheUpdate(scope.clientContext); operation.setDependency(responseCache.updateVariantCacheEntry( target, conditionalRequest,
private void connectEndpoint(final ConnectionEndpoint endpoint, final HttpClientContext context) throws IOException { if (cancellableDependency != null) { if (cancellableDependency.isCancelled()) { throw new RequestFailedException("Request aborted"); } } final RequestConfig requestConfig = context.getRequestConfig(); final Timeout connectTimeout = requestConfig.getConnectTimeout(); manager.connect(endpoint, connectTimeout, context); }
if (cacheConfig.isFreshnessCheckEnabled()) { final CancellableDependency operation = scope.cancellableDependency; operation.setDependency(responseCache.getCacheEntry(target, request, new FutureCallback<HttpCacheEntry>() {
operation.setDependency(responseCache.getVariantCacheEntriesWithEtags( target, request,
operation.setDependency(responseCache.flushCacheEntriesInvalidatedByRequest(target, request, new FutureCallback<Boolean>() { operation.setDependency(responseCache.getCacheEntry(target, request, new FutureCallback<HttpCacheEntry>() {
void triggerNewCacheEntryResponse(final HttpResponse backendResponse, final Date responseDate, final ByteArrayBuffer buffer) { final CancellableDependency operation = scope.cancellableDependency; operation.setDependency(responseCache.createCacheEntry( target, request, backendResponse, buffer, requestDate, responseDate, new FutureCallback<HttpCacheEntry>() { @Override public void completed(final HttpCacheEntry newEntry) { log.debug("Backend response successfully cached"); try { final SimpleHttpResponse cacheResponse = responseGenerator.generateResponse(request, newEntry); triggerResponse(cacheResponse, scope, asyncExecCallback); } catch (final ResourceIOException ex) { asyncExecCallback.failed(ex); } } @Override public void failed(final Exception ex) { asyncExecCallback.failed(ex); } @Override public void cancelled() { asyncExecCallback.failed(new InterruptedIOException()); } })); }
operation.setDependency(execRuntime.execute( new LoggingAsyncClientExchangeHandler(log, exchangeId, internalExchangeHandler), clientContext)); } else { operation.setDependency(execRuntime.execute( internalExchangeHandler, clientContext));
void triggerUpdatedCacheEntryResponse(final HttpResponse backendResponse, final Date responseDate) { final CancellableDependency operation = scope.cancellableDependency; recordCacheUpdate(scope.clientContext); operation.setDependency(responseCache.updateCacheEntry( target, request,
void updateVariantCacheEntry(final HttpResponse backendResponse, final Date responseDate, final Variant matchingVariant) { recordCacheUpdate(scope.clientContext); operation.setDependency(responseCache.updateVariantCacheEntry( target, conditionalRequest,
if (cacheConfig.isFreshnessCheckEnabled()) { final CancellableDependency operation = scope.cancellableDependency; operation.setDependency(responseCache.getCacheEntry(target, request, new FutureCallback<HttpCacheEntry>() {
operation.setDependency(execRuntime.execute( new LoggingAsyncClientExchangeHandler(log, exchangeId, internalExchangeHandler), clientContext)); } else { operation.setDependency(execRuntime.execute(internalExchangeHandler, clientContext));
log.debug(exchangeId + ": acquiring connection with route " + route); cancellableDependency.setDependency(execRuntime.acquireEndpoint( route, userToken, clientContext, new FutureCallback<AsyncExecRuntime>() {
cancellableDependency.setDependency(new Cancellable() {
operation.setDependency(responseCache.getVariantCacheEntriesWithEtags( target, request,
switch (step) { case HttpRouteDirector.CONNECT_TARGET: operation.setDependency(execRuntime.connectEndpoint(clientContext, new FutureCallback<AsyncExecRuntime>() { operation.setDependency(execRuntime.connectEndpoint(clientContext, new FutureCallback<AsyncExecRuntime>() {