RFR 8237858: PlainSocketImpl.socketAccept() handles EINTR incorrectly
Alan Bateman
Alan.Bateman at oracle.com
Sat Jul 4 14:52:54 UTC 2020
On 04/07/2020 15:44, Martin Buchholz wrote:
> On Fri, Jul 3, 2020 at 11:12 PM Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
>> - "service" isn't a great name for the Executor. Also you can make use
>> of try-finally, e.g.
>> ExecutorService executor = Executors.newFixedThreadPool(1);
>> try { ... } finally { executor.shutdown(); }
> If you want to do this structured-concurrency-style, you should wait
> for all the threads you started to complete (they might block!).
> shutdown is not enough - you also want awaitTermination.
>
There is a future::get in the block so shutdown will be invoked when the
task queue is empty, so it should lead to termination. However you are
right that if the test throws before this then it may just shutdown
while the "Server" task is still running. It could be make a lot more
robust.
-Alan
More information about the net-dev
mailing list