Fixes #11527 - Reduce ByteBuffer churning in HttpOutput.
Now releasing the buffer back into the pool. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
d39899fc29
commit
57266039d8
|
@ -287,7 +287,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
||||||
_state = State.CLOSED;
|
_state = State.CLOSED;
|
||||||
closedCallback = _closedCallback;
|
closedCallback = _closedCallback;
|
||||||
_closedCallback = null;
|
_closedCallback = null;
|
||||||
releaseBuffer(failure);
|
releaseBuffer();
|
||||||
wake = updateApiState(failure);
|
wake = updateApiState(failure);
|
||||||
}
|
}
|
||||||
else if (_state == State.CLOSE)
|
else if (_state == State.CLOSE)
|
||||||
|
@ -508,7 +508,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
||||||
try (AutoLock l = _channelState.lock())
|
try (AutoLock l = _channelState.lock())
|
||||||
{
|
{
|
||||||
_state = State.CLOSED;
|
_state = State.CLOSED;
|
||||||
releaseBuffer(failure);
|
releaseBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,15 +648,12 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
||||||
return _aggregate;
|
return _aggregate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void releaseBuffer(Throwable failure)
|
private void releaseBuffer()
|
||||||
{
|
{
|
||||||
if (_aggregate != null)
|
if (_aggregate != null)
|
||||||
{
|
{
|
||||||
ByteBufferPool bufferPool = _channel.getConnector().getByteBufferPool();
|
ByteBufferPool bufferPool = _channel.getConnector().getByteBufferPool();
|
||||||
if (failure == null)
|
|
||||||
bufferPool.release(_aggregate);
|
bufferPool.release(_aggregate);
|
||||||
else
|
|
||||||
bufferPool.remove(_aggregate);
|
|
||||||
_aggregate = null;
|
_aggregate = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1403,7 +1400,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
||||||
_commitSize = config.getOutputAggregationSize();
|
_commitSize = config.getOutputAggregationSize();
|
||||||
if (_commitSize > _bufferSize)
|
if (_commitSize > _bufferSize)
|
||||||
_commitSize = _bufferSize;
|
_commitSize = _bufferSize;
|
||||||
releaseBuffer(null);
|
releaseBuffer();
|
||||||
_written = 0;
|
_written = 0;
|
||||||
_writeListener = null;
|
_writeListener = null;
|
||||||
_onError = null;
|
_onError = null;
|
||||||
|
|
Loading…
Reference in New Issue