RFR[11] of JDK-8208280,java/nio/channels/Selector/RegisterDuringSelect.java fails with "key not removed from key set"
Alan Bateman
Alan.Bateman at oracle.com
Thu Aug 30 11:39:40 UTC 2018
On 30/08/2018 04:33, Hamlin Li wrote:
> Thank you for detailed reviewing, I have modified as you suggested,
> please review it again:
> http://cr.openjdk.java.net/~mli/8208280/webrev.03/
This is much cleaner but I'm still concerned that the test method is
registering the channel with the selector - I think this should be in
the test body to make it more obvious what is bring tested.
In terms of the tests then the first one has changed in a subtle way, it
should be:
SelectorUtils.spinUntilLocked(...)
SelectionKey key = sc.register(...);
try {
if (!sel.keys().contains(key)) throw new RuntimeException(...);
} finally {
sel.wakeup();
}
This is important to test that the key has been added to the key-set
while a selection operation is in progress.
A minor point is that Test doesn't need the t field, it can be a local
in the test method. Also L72 is a left over from a previous iteration
and can be removed.
-Alan
More information about the nio-dev
mailing list