RFR: 8247614: java/nio/channels/DatagramChannel/Connect.java timed out

Alan Bateman alanb at openjdk.java.net
Thu Oct 15 14:31:17 UTC 2020


On Thu, 15 Oct 2020 14:14:16 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> test/jdk/java/nio/channels/DatagramChannel/Connect.java line 70:
>> 
>>> 68:                     });
>>> 69:                 });
>>> 70:         future.join();
>> 
>> Would ExecutorService invokeAny help you hear?
>
> I don't think so - we kind of want to do the opposite: what we want is stop the test if any of the two tasks throws an
> exception. The previous version of the test might have been blocked in the first call to `Thread::join` and not even
> notice that the other thread had exited - which meant that the test would fail in timeout and not even report the
> exception that made the other thread terminate. Here the allOf `future` will be completed as soon as: one task throws
> an exception (thanks to the dependent action), or the two tasks complete successfully. There are many ways to do that -
> but I find the solution that Conor came up with rather elegant.

Okay, they might new combinators here in the future that makes this a bit easier.

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

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


More information about the nio-dev mailing list