RFR: 8247614: java/nio/channels/DatagramChannel/Connect.java timed out [v2]
Conor Cleary
ccleary at openjdk.java.net
Wed Oct 21 10:00:19 UTC 2020
On Tue, 20 Oct 2020 13:48:49 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Conor Cleary has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - 8247614: Actor/Reactor implement AutoCloseable
>> - 8247614: Thread pool created for use with futures
>
> test/jdk/java/nio/channels/DatagramChannel/Connect.java line 64:
>
>> 62: } finally {
>> 63: threadPool.shutdown();
>> 64: }
>
> I believe it would be better to call threadPool.shutdown() **after** having closed the Actor/Reactor: closing the Actor/Reactor makes sure that both tasks terminate - and shutdown() will wait for the tasks to terminate. Therefore I'd suggest to create the threadPool in the `test` method instead, and pass it as first parameter to the `invoke` method.
As you suggested, I moved the threadPool.shutdown() call to the main test method instead of having it in invoke. While it seems that shutdown() does conduct an orderly shutdown of the pool, I agree that its best to be safe and to make absolutely certain that Actor/Reactor close properly..
-------------
PR: https://git.openjdk.java.net/jdk/pull/679
More information about the nio-dev
mailing list