RFR: 8219014: (bf) Add absolute bulk put methods which accept a source Buffer

Claes Redestad redestad at openjdk.java.net
Mon Nov 2 16:07:00 UTC 2020


On Mon, 2 Nov 2020 14:12:36 GMT, Martin Thompson <github.com+760524+mjpt777 at openjdk.org> wrote:

> The other method implementations which do a absolute put or get do not modify the position. This makes them more useful in a multi-threaded context as different threads can be updating different ranges of the buffer concurrently. To replace Unsafe we need absolute index methods that do not update position.

Thanks for pointing out the importance of not depending on `position` for these methods to be as helpful as they can be. 

I checked and the new methods here (`put(int, $Type$Buffer, int, int)`) does not modify or read `position`. I think the diff here makes it look like `position` is in use for the new methods since the diff gets bungled up with the preceding, position-relative `put($Type$Buffer)` method, and that this played some tricks.

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

PR: https://git.openjdk.java.net/jdk/pull/969


More information about the nio-dev mailing list