Merge pull request #4180 from eclipse/jetty-9.4.x-4179-SendCallback-gc

Issue #4179 SendCallback GC
This commit is contained in:
Simone Bordet 2019-10-10 12:45:30 +02:00 committed by GitHub
commit ec56739d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -848,19 +848,22 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
}
}
private void releaseHeader()
private Callback release()
{
ByteBuffer h = _header;
Callback complete = _callback;
_callback = null;
_info = null;
_content = null;
if (_header != null)
_bufferPool.release(_header);
_header = null;
if (h != null)
_bufferPool.release(h);
return complete;
}
@Override
protected void onCompleteSuccess()
{
releaseHeader();
_callback.succeeded();
release().succeeded();
if (_shutdownOut)
getEndPoint().shutdownOutput();
}
@ -868,8 +871,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
@Override
public void onCompleteFailure(final Throwable x)
{
releaseHeader();
failedCallback(_callback, x);
failedCallback(release(), x);
if (_shutdownOut)
getEndPoint().shutdownOutput();
}