Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ private void triggerResponse(
final SimpleBody body = cacheResponse.getBody();
final byte[] content = body != null ? body.getBodyBytes() : null;
final ContentType contentType = body != null ? body.getContentType() : null;
AsyncDataConsumer dataConsumer = null;
try {
final AsyncDataConsumer dataConsumer = asyncExecCallback.handleResponse(
dataConsumer = asyncExecCallback.handleResponse(
cacheResponse,
content != null ? new BasicEntityDetails(content.length, contentType) : null);
if (dataConsumer != null) {
Expand All @@ -139,6 +140,10 @@ private void triggerResponse(
asyncExecCallback.completed();
} catch (final HttpException | IOException ex) {
asyncExecCallback.failed(ex);
} finally {
if (dataConsumer != null) {
dataConsumer.releaseResources();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public void streamEnd(final List<? extends Header> trailers) throws HttpExceptio

@Override
public void releaseResources() {
dctx.close();
if (closed.compareAndSet(false, true)) {
dctx.close();
}
downstream.releaseResources();
}
}
Loading