RFR: 4750574: (se spec) Selector spec should clarify calculation of select return value

Daniel Fuchs dfuchs at openjdk.java.net
Wed Jan 26 10:23:34 UTC 2022


On Wed, 26 Jan 2022 00:19:36 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Improve the description of the return value of each of the `Selector.select()` methods which do not accept an action parameter.

Ah, yes - I have been bitten by this before. I wonder if it would deserve an `@apiNote` to say that the number returned doesn't always reflect the number of keys present in the selected-key set, and that a caller may consider clearing the selected-key set before calling these methods if they want to ensure that the number returned is equal to the size of the selected-key set.

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

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


More information about the nio-dev mailing list