The Http1Response has now a complex logic to avoid losing data during the switching of its phases (reading headers, reading body) and the eventual upgrade to HTTP/2. It uses synchronization, a readLock, and a queue, to attempt to ensure that byte buffers are delivered in the right order.
This logic could probably be considerably simplified if the queue was managed at the Http1Exchange level, with the help of a SequentialScheduler to ensure that byte buffers are handled in the right sequence. This should also make it easier to delegate the heavy part of a the task to an executor in order to avoid starving the selector thread.
This logic could probably be considerably simplified if the queue was managed at the Http1Exchange level, with the help of a SequentialScheduler to ensure that byte buffers are handled in the right sequence. This should also make it easier to delegate the heavy part of a the task to an executor in order to avoid starving the selector thread.