On Mon, 21 Nov 2022 11:36:44 GMT, Per Minborg <[email protected]> wrote:
>> src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java line 252:
>>
>>> 250: try {
>>> 251: // 'dst' is guaranteed not to be associated with a
>>> closeable session.
>>> 252: // Hence, there is no need for acquiring any session.
>>
>> This comment is will be confusing to anyone reading this code. Is this
>> really needed?
>
> The reason for the comment is to make it clear why `DirectBuffer::address`
> can be used directly without guarding. This will also reduce the probability
> of unnecessary guarding being added in the future. However, if the consensus
> is that these comments just adds confusion, I am happy to remove them.
I'd prefer to see this comment removed from all places that are obviously
interacting with the direct buffer cache. These usages are try-finally to
acquire and return the temporary direct buffer cache back to the cache. Talking
about closable sessions here is definitely confusing.
-------------
PR: https://git.openjdk.org/jdk/pull/11260