RFR: 4750574: (se spec) Selector spec should clarify calculation of select return value
Brian Burkhalter
bpb at openjdk.java.net
Wed Feb 2 18:46:09 UTC 2022
On Wed, 26 Jan 2022 10:18:31 GMT, Daniel Fuchs <dfuchs 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.
@dfuch Regarding the API note, maybe add an example snippet instead under a separate issue to be created?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7220
More information about the nio-dev
mailing list