Integrated: 8319531: FileServerHandler::discardRequestBody could be improved

Darragh Clarke dclarke at openjdk.org
Thu Nov 16 10:57:42 UTC 2023


On Fri, 10 Nov 2023 15:26:06 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:

> **Problem**
> `discardRequestBody` calls `InputStream::readAllBytes` to read and discard all the request body bytes. This is somewhat wasteful as they can instead be skipped.
> 
> **Changes**
> - Updated `FileServerHandler::discardRequestBody` to use `InputStream::skip`.
> - Created skip in `LeftOverInputStream` based on [InputStream](https://github.com/openjdk/jdk/blob/c9657cad124d2be10b8d6006d0ca9a038b1c5945/src/java.base/share/classes/java/io/InputStream.java#L540). This gets used by `FixedLengthInputStream` and `ChunkedInputStream` which previously had been using the skip implementation from `FilteredInputStream` which would have caused blocking.
> 
> - Also made a minor change to `LeftOverInputStream::Drain` to change bufSize.
> 
> 
> I ran test tiers 1-3 and all tests are passing with these changes

This pull request has now been integrated.

Changeset: 1d968866
Author:    Darragh Clarke <dclarke at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1d9688667e667dc710d64e52f1e918e047beaca3
Stats:     43 lines in 2 files changed: 27 ins; 9 del; 7 mod

8319531: FileServerHandler::discardRequestBody could be improved

Reviewed-by: dfuchs, jpai, michaelm

-------------

PR: https://git.openjdk.org/jdk/pull/16616


More information about the net-dev mailing list