mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
8207833: java/nio/channels/Selector/SelectWithConsumer.java testCancel() fails intermittently
Reviewed-by: alanb
This commit is contained in:
parent
4823354a6a
commit
17f7056d82
1 changed files with 9 additions and 3 deletions
|
@ -548,12 +548,18 @@ public class SelectWithConsumer {
|
|||
// write to sink to ensure that the source is readable
|
||||
sink.write(messageBuffer());
|
||||
|
||||
sink.configureBlocking(false);
|
||||
source.configureBlocking(false);
|
||||
SelectionKey key1 = sink.register(sel, SelectionKey.OP_WRITE);
|
||||
SelectionKey key2 = source.register(sel, SelectionKey.OP_READ);
|
||||
SelectionKey key1 = source.register(sel, SelectionKey.OP_READ);
|
||||
// make sure pipe source is readable before we do following checks.
|
||||
// this is sometime necessary on windows where pipe is implemented
|
||||
// as a pair of connected socket, so there is no guarantee that written
|
||||
// bytes on sink side is immediately available on source side.
|
||||
sel.select();
|
||||
|
||||
sink.configureBlocking(false);
|
||||
SelectionKey key2 = sink.register(sel, SelectionKey.OP_WRITE);
|
||||
sel.selectNow();
|
||||
|
||||
assertTrue(sel.keys().contains(key1));
|
||||
assertTrue(sel.keys().contains(key2));
|
||||
assertTrue(sel.selectedKeys().contains(key1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue