RFR[8246132]: 'AsynchronousSocketChannelNAPITest failing with a NotYetConnectedException'

Alan Bateman Alan.Bateman at oracle.com
Fri Jun 5 05:33:08 UTC 2020



On 04/06/2020 22:08, Daniel Fuchs wrote:
> Hi Patrick,
>
> Looks good, but for one thing.
>
> Throwing in the failed() callback will probably accomplish
> nothing since that is likely be called asynchronously in some
> background thread. So if the connect doesn't succeed immediately
> but fail instead at a later time, the test will block forever
> waiting on the CountDownLatch until it gets interrupted by
> the jtreg timeout.
>
> Instead of using a CountDownLatch, I'd suggest using a
> CompletableFuture<Boolean> which will allow to rethrow
> the exception from the main thread.
Might be simpler to just change it to c.connect(remote).get(); to that 
it blocks until the connect is established (or it fails), no need to use 
the 3-arg connect method here.

-Alan


More information about the net-dev mailing list